From: Dan Carpenter Date: Mon, 20 Dec 2010 15:42:17 +0300 Subject: [ath9k-devel] smatch stuff: potential read past the end of the buffer In-Reply-To: <400C43189542CE41BC0A5B252FC90136952F0594D7@SJEXCHCCR02.corp.ad.broadcom.com> References: <20101220083041.GQ1936@bicker> <400C43189542CE41BC0A5B252FC90136952F0594D7@SJEXCHCCR02.corp.ad.broadcom.com> Message-ID: <20101220124217.GU1936@bicker> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ath9k-devel@lists.ath9k.org On Mon, Dec 20, 2010 at 02:16:56AM -0800, Arend Van Spriel wrote: > Hi Dan, > > Why not use min() function? > index = min(COMP_HDR_LEN + osize, 2046); > mchecksum = word[index] | > (word[index + 1] << 8); > > Or would smatch miss this in its analysis? That would silence the warning, but is it the right fix? I thought maybe we should make word a larger buffer? regards, dan carpenter