Bug 204768

Summary: usr/src/sys/arm64/arm64/gic_v3.c:157: possible bad size ?
Product: Base System Reporter: David Binderman <dcb314>
Component: armAssignee: Ed Maste <emaste>
Status: Closed FIXED    
Severity: Affects Only Me CC: emaste
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: arm64   
OS: Any   
Bug Depends on:    
Bug Blocks: 203349    

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

Log:
  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

Changes:
  head/sys/arm64/arm64/gic_v3.c