From: akpm@linux-foundation.org Subject: [patch 04/29] scsi: remove unnecessary check in drivers/scsi/sg.c Date: Tue, 06 Mar 2007 02:46:28 -0800 Message-ID: <200703061046.l26AkSwU019997@shell0.pdx.osdl.net> Return-path: Received: from smtp.osdl.org ([65.172.181.24]:34910 "EHLO smtp.osdl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964785AbXCFKqj (ORCPT ); Tue, 6 Mar 2007 05:46:39 -0500 Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: James.Bottomley@steeleye.com Cc: linux-scsi@vger.kernel.org, akpm@linux-foundation.org, snakebyte@gmx.de, dougg@torque.net From: Eric Sesterhenn coverity spotted this (cid #758). All callers dereference sfp, so we dont need this check. In addition to this, we dereference it earlier in the function. Signed-off-by: Eric Sesterhenn Cc: Douglas Gilbert Cc: James Bottomley Signed-off-by: Andrew Morton --- drivers/scsi/sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN drivers/scsi/sg.c~remove-unnecessary-check-in-drivers-scsi-sgc drivers/scsi/sg.c --- a/drivers/scsi/sg.c~remove-unnecessary-check-in-drivers-scsi-sgc +++ a/drivers/scsi/sg.c @@ -1837,7 +1837,7 @@ sg_build_indirect(Sg_scatter_hold * schp int blk_size = buff_size; struct page *p = NULL; - if ((blk_size < 0) || (!sfp)) + if (blk_size < 0) return -EFAULT; if (0 == blk_size) ++blk_size; /* don't know why */ _