Bug 204768 - usr/src/sys/arm64/arm64/gic_v3.c:157: possible bad size ?
Summary: usr/src/sys/arm64/arm64/gic_v3.c:157: possible bad size ?
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Only Me
Assignee: Ed Maste
Keywords: patch
Depends on:
Blocks: 203349
  Show dependency treegraph
Reported: 2015-11-23 16:41 UTC by David Binderman
Modified: 2015-11-26 21:08 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2015-11-23 16:41:49 UTC
[usr/src/sys/arm64/arm64/gic_v3.c:157]: (warning) Size of pointer 'gic_res' used instead of size of its data.

Source code is

   sc->gic_res = malloc(
        sizeof(sc->gic_res) * (sc->gic_redists.nregions + 1),
        M_GIC_V3, M_WAITOK);

Maybe better code

   sc->gic_res = malloc(
        sizeof(*(sc->gic_res)) * (sc->gic_redists.nregions + 1),
        M_GIC_V3, M_WAITOK);
Comment 1 commit-hook freebsd_committer 2015-11-26 21:06:49 UTC
A commit references this bug:

Author: emaste
Date: Thu Nov 26 21:05:56 UTC 2015
New revision: 291373
URL: https://svnweb.freebsd.org/changeset/base/291373

  Correct arm64 gic_v3 sizeof argument

  No functional change as 'struct resource *' and 'struct resource **'
  have the same size, but the former is the proper type.

  PR:		204768
  Submitted by:	David Binderman