On Sun, 29 May 2016, Garrett Cooper wrote:

Log:
 Mark out_of_mem(..) and usage(..) with __dead2 as they both directly call exit
 as a hint to static analysis tools

This is bogus for usage() since it is static so only very broken static
analyis tools can't see its full details.

Modified: head/usr.sbin/rpc.statd/statd.c
==============================================================================
--- head/usr.sbin/rpc.statd/statd.c     Sun May 29 04:02:02 2016        
(r300934)
+++ head/usr.sbin/rpc.statd/statd.c     Sun May 29 04:18:47 2016        
(r300935)
@@ -72,9 +72,9 @@ static int    create_service(struct netconf
static void     complete_service(struct netconfig *nconf, char *port_str);
static void     clearout_service(void);
static void handle_sigchld(int sig);
-void out_of_mem(void);
+void out_of_mem(void) __dead2;

This is even more bogus:
- out_of_mem() is public, and this adds __dead2 in the one place that clearly
  doesn't need it
- the declarartions are unsorted internally and externally.  Prototypes for
  public functions belong in a header file.  Some are already there, but
  this one is unsorted into the middle of static ones
- however, perhaps this function should be static.  It is only directly
  referenced in this file.  I don't know if it is also referenced in some
  other utility or rpc generated code.  If so, then these are probably
  missing the __dead2.

-static void usage(void);
+static void usage(void) __dead2;

There are also many lexical (indentation) style bugs near here, in all of
the newer prototypes starting with handle_sigchld().


int
main(int argc, char **argv)
@@ -613,7 +613,7 @@ clearout_service(void)
}

static void
-usage()
+usage(void)

Perhaps Coverity was just complaining about this K&R definition.  No change
was needed, since there is a prototype in scope.

Bruce
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to