From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964996AbdCVTlx (ORCPT ); Wed, 22 Mar 2017 15:41:53 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:20326 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759363AbdCVTkK (ORCPT ); Wed, 22 Mar 2017 15:40:10 -0400 Date: Wed, 22 Mar 2017 22:39:45 +0300 From: Dan Carpenter 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 Subject: Re: [PATCH] scsi: fcoe: sanity check string size for store_ctrl_mode option Message-ID: <20170322193945.GK32449@mwanda> References: <20170322140137.28485-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170322140137.28485-1-colin.king@canonical.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: 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