From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Jarzmik Date: Thu, 29 Nov 2012 18:46:54 +0000 Subject: Re: [patch] mtg: docg3: potential divide by zero in doc_write_oob() Message-Id: <87zk201c2p.fsf@free.fr> List-Id: References: <20121129141651.GA12199@elgon.mountain> In-Reply-To: <20121129141651.GA12199@elgon.mountain> (Dan Carpenter's message of "Thu, 29 Nov 2012 17:16:51 +0300") MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: Mike Dunn , Artem Bityutskiy , kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org, Ivan Djelic , David Woodhouse Dan Carpenter writes: > If we set oobdelta to zero then we will either return -EINVAL or hit > a divide (modulus) by zero on the next line when we check > "(ooblen % oobdelta)". It's better to just return -EINVAL here instead. > > Signed-off-by: Dan Carpenter > --- > Static analysis. I don't know if it's actually possible to hit this > condition. I don't know any possibility to reach that condition, nonetheless the patch makes the code more robust, therefore : Acked-by: Robert Jarzmik Cheers. -- Robert From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1-g21.free.fr ([2a01:e0c:1:1599::10]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Te98k-0007bj-LE for linux-mtd@lists.infradead.org; Thu, 29 Nov 2012 18:47:19 +0000 From: Robert Jarzmik To: Dan Carpenter Subject: Re: [patch] mtg: docg3: potential divide by zero in doc_write_oob() References: <20121129141651.GA12199@elgon.mountain> Date: Thu, 29 Nov 2012 19:46:54 +0100 In-Reply-To: <20121129141651.GA12199@elgon.mountain> (Dan Carpenter's message of "Thu, 29 Nov 2012 17:16:51 +0300") Message-ID: <87zk201c2p.fsf@free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Mike Dunn , Artem Bityutskiy , kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org, Ivan Djelic , David Woodhouse List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Dan Carpenter writes: > If we set oobdelta to zero then we will either return -EINVAL or hit > a divide (modulus) by zero on the next line when we check > "(ooblen % oobdelta)". It's better to just return -EINVAL here instead. > > Signed-off-by: Dan Carpenter > --- > Static analysis. I don't know if it's actually possible to hit this > condition. I don't know any possibility to reach that condition, nonetheless the patch makes the code more robust, therefore : Acked-by: Robert Jarzmik Cheers. -- Robert