From owner-svn-src-all@freebsd.org Sun Apr 3 19:31:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A97EB01F43 for ; Sun, 3 Apr 2016 19:31:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm4.bullet.mail.bf1.yahoo.com (nm4.bullet.mail.bf1.yahoo.com [98.139.212.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 445561CB7 for ; Sun, 3 Apr 2016 19:31:23 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1459711876; bh=1yMhh91ktnqVsr1l9142YjB9xHPpu3m2ZsgnlWtRzqE=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=mnLJQVmU1C0y/5iayEqvFLucjrhs0IyTj0Pmf1njuBt1Sq1Qyb41V3M62KuXLO6mvtEjgdRut1BgHdqcJFPHcula2g8+s4pvPwE6cPjaCd6FHz6iGgQG020lFfW179/bOzYsNLmxlf/dWmxBGNOQDJ20CrAyNKgAcAW0RGdJurZryOj/r1S01eD4Iue6evFvHk2ICiyd1WdLhOUfVn5ex5763ejhdi6SmEbnixd6CxmdL4nMH8mqDrUh8qB2p+x6SIpK5nTLlOR6HhY95ICAnxAmNHsFmjDHkzWpQXQpiXQwM/K3BGEomltEcNlGPmrfgqPS2HIqFjmUqiVZPRWzJg== Received: from [66.196.81.172] by nm4.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:31:16 -0000 Received: from [98.139.211.195] by tm18.bullet.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:31:16 -0000 Received: from [127.0.0.1] by smtp204.mail.bf1.yahoo.com with NNFMP; 03 Apr 2016 19:31:16 -0000 X-Yahoo-Newman-Id: 378561.33015.bm@smtp204.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: nxScPWMVM1nn8bNxo2Ukuz5srFN_vdvrJGAjbTgp9udtEIT zqfUO69b9cuOrbJjpdON0qU6LgnGGiWcLTY57Bn.6CB3EwLulUUxf6PEFeqi jZyEhcCSadjBrHtukTjPYeUb7I7U0sXA4f9oqufPHAoDN9cQMJ.xuHpX7Jic 4PbTfqAgp4hrUWVkzRuwxTzOKm6h7mSvqLQVxKZkozik3otNgsEpBPTKfRzj THAmC81ccw2r2cwnhI26xPnfQt2aSetNkAM8tcOh9AXmfO05MoN4._jIuDt1 OIs_o3FxrGqhPjPdReeI.AFeRWaUlja2iq9eDX1OQt_V7HeAXd_4YegxryE0 A_0t4m98ENcuSUR6vDriES9jIIvUkp1M.O3rRwTerZCvuftc.AsjD59GRvNk pXl0W5D2LCG0YHZLBo1gT07hUhputi92B9xeZvZZJWBAf_.Y68hU5m2xxi7f 1s0oD2pt07VCisyPW6ig_kiZze7z0f2It13FUeNmflqixvRoQnfz8qDpn_bp KnLU44Ltn7s5vkKPdLFfPB5r8A2LelFm55Q-- X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r297527 - head/sys/cam/scsi To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201604031638.u33GcGsa092204@repo.freebsd.org> From: Pedro Giffuni Message-ID: <57016FE2.1070607@FreeBSD.org> Date: Sun, 3 Apr 2016 14:32:50 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <201604031638.u33GcGsa092204@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Apr 2016 19:31:23 -0000 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.