On 03/04/2016 11:38, Pedro F. Giffuni wrote:
Author: pfg
Date: Sun Apr  3 16:38:15 2016
New Revision: 297527
URL: https://svnweb.freebsd.org/changeset/base/297527

Log:
   chdone(): Prevent returning uninitialized scalar value.
If there is an error different from ERESTART, there is some
   chance that we may end up accessing an uninitialized value. This
   doesn't seem likely/possible but initialize announce_buf[0],
   just in case.
CID: 1006486

Modified:
   head/sys/cam/scsi/scsi_ch.c

Modified: head/sys/cam/scsi/scsi_ch.c
==============================================================================
--- head/sys/cam/scsi/scsi_ch.c Sun Apr  3 16:25:51 2016        (r297526)
+++ head/sys/cam/scsi/scsi_ch.c Sun Apr  3 16:38:15 2016        (r297527)
@@ -651,6 +651,7 @@ chdone(struct cam_periph *periph, union
                } else {
                        int error;
+ announce_buf[0] = '\0';
                        error = cherror(done_ccb, CAM_RETRY_SELTO,
                                        SF_RETRY_UA | SF_NO_PRINT);
                        /*


This one is rather tricky ...
I wanted to play it safe so I initialized it here but I think that:
1) The late initialization in line 718 is now reduntant.
2) I could have instead moved the initialization in line 718 down one loop and
it would have had the same effect. The code would be more difficult to
understand if I had done it though.

Perhaps someone more familiar with the code wants to review this (I tried
with the author but he didn't reply and this code is old so I don't blame him).

Pedro.


_______________________________________________
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