From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Wed, 22 Mar 2017 19:39:45 +0000 Subject: Re: [PATCH] scsi: fcoe: sanity check string size for store_ctrl_mode option Message-Id: <20170322193945.GK32449@mwanda> List-Id: References: <20170322140137.28485-1-colin.king@canonical.com> In-Reply-To: <20170322140137.28485-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Colin King Cc: Johannes Thumshirn , "James E . J . Bottomley" , "Martin K . Petersen" , fcoe-devel@open-fcoe.org, linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org On Wed, Mar 22, 2017 at 02:01:37PM +0000, Colin King wrote: > From: Colin Ian King > > Reading and writing to mode[count - 1] implies the count should not > be less than 1 so add a sanity check for this. > > Detected with CoverityScan, CID#1357345 ("Overflowed array index write") > > Signed-off-by: Colin Ian King This is harmless, of course, but count can't be zero. This is a sysfs file so we test for zero size writes in sysfs_kf_write() and return early. regards, dan carpenter