Author: cem
Date: Mon Mar 26 21:57:44 2018
New Revision: 331594
URL: https://svnweb.freebsd.org/changeset/base/331594

Log:
  libctf: Appease Coverity overrun warnings
  
  Rather than zeroing and reading into the a smaller union member the full
  union size, just zero and read directly into the union.
  
  No functional change intended.
  
  Reported by:  Coverity
  Sponsored by: Dell EMC Isilon

Modified:
  head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c

Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c   Mon Mar 26 
21:14:20 2018        (r331593)
+++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c   Mon Mar 26 
21:57:44 2018        (r331594)
@@ -230,12 +230,12 @@ ctf_fdopen(int fd, int *errp)
        bzero(&ctfsect, sizeof (ctf_sect_t));
        bzero(&symsect, sizeof (ctf_sect_t));
        bzero(&strsect, sizeof (ctf_sect_t));
-       bzero(&hdr.ctf, sizeof (hdr));
+       bzero(&hdr, sizeof (hdr));
 
        if (fstat64(fd, &st) == -1)
                return (ctf_set_open_errno(errp, errno));
 
-       if ((nbytes = pread64(fd, &hdr.ctf, sizeof (hdr), 0)) <= 0)
+       if ((nbytes = pread64(fd, &hdr, sizeof (hdr), 0)) <= 0)
                return (ctf_set_open_errno(errp, nbytes < 0? errno : ECTF_FMT));
 
        /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to