8696 genunix: auditsys variable 'model' set but not used

Review Request #668 — Created Oct. 3, 2017 and submitted

tsoome
illumos-gate
8696
9d8b93a...
general
../../common/syscall/auditsys.c: In function 'getaudit':
../../common/syscall/auditsys.c:171:10: error: variable 'model' set but not used
 [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'getaudit_addr':
../../common/syscall/auditsys.c:220:10: error: variable 'model' set but not used
 [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'setaudit':
../../common/syscall/auditsys.c:274:10: error: variable 'model' set but not used
 [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'setaudit_addr':
../../common/syscall/auditsys.c:332:10: error: variable 'model' set but not used
 [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'getkaudit':
../../common/syscall/auditsys.c:555:10: error: variable 'model' set but not used
 [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'setkaudit':
../../common/syscall/auditsys.c:608:10: error: variable 'model' set but not used
 [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'setumask':
../../common/syscall/auditsys.c:879:10: error: variable 'model' set but not used
 [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'setsmask':
../../common/syscall/auditsys.c:962:10: error: variable 'model' set but not used
 [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'getpinfo':
../../common/syscall/auditsys.c:1155:10: error: variable 'model' set but not use
d [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'getpinfo_addr':
../../common/syscall/auditsys.c:1227:10: error: variable 'model' set but not use
d [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
../../common/syscall/auditsys.c: In function 'setpmask':
../../common/syscall/auditsys.c:1304:10: error: variable 'model' set but not used [-Werror=unused-but-set-variable]
  model_t model;
          ^~~~~
cc1: all warnings being treated as errors


  • 0
  • 0
  • 1
  • 0
  • 1
Description From Last Updated
yuripv
  1. Ship It!
  2. 
      
jgmills
  1. Why don't you just remove the unused variable, along with anything that sets it?

    1. Yeah, why not?

    2. model is set and used on the 64-bit kernel. The problem is that the STRUCT_INIT() macro will conditionally not set the model payload on a 32-bit kernel. It'd be incorrect to remove the variable, because it is actually used in some conditions.

    3. Oh, so that makes this a little bit tricky to fix.
      Just adding __unused is also not quite right, correct?
      (The varialbe is not always unused.)

  2. 
      
rm
  1. 
      
  2. usr/src/uts/common/syscall/auditsys.c (Diff revision 1)
     
     
    The problem with all of these (and this will happen for all 32-bit kernel users) is that the STRUCT_INIT() doesn't end up being used and read. What I'd suggest doing is combining the 32-bit lint and non-lint versions of STRUCT_SET_HANDLE(). This will cause it to be used. We can even just define a model member there for consistency with the 64-bit version.
    1. Just to it's clear, this applies to all of the lines.

    2. I guess we could let this always use the #ifdef __lint variant:
      ```

      ifdef __lint

      define STRUCT_SET_HANDLE(handle, umodel, addr) \

      (void) (umodel);                        \
      (handle).ptr = (addr)
      

      else

      define STRUCT_SET_HANDLE(handle, umodel, addr) \

      (handle).ptr = (addr)
      

      endif / __lint /

    3. http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/sys/model.h#165

  3. 
      
tsoome
rm
  1. Thanks for changing this around. Seems reasonable to me!

    1. Thanks for suggestion - it actually did also fix sharefs, nfs, sockfs as well.

  2. 
      
yuripv
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...