lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1300773639-19051-1-git-send-email-tm@tao.ma>
Date:	Tue, 22 Mar 2011 14:00:39 +0800
From:	Tao Ma <tm@....ma>
To:	linux-kernel@...r.kernel.org
Cc:	James Bottomley <James.Bottomley@...e.de>
Subject: [PATCH RESEND] sd: Free the page in case of unknown provisioning_mode in scsi_setup_discard_cmnd.

From: Tao Ma <boyu.mt@...bao.com>

This patch is inspired by a build warning.
drivers/scsi/sd.c:544: warning: ‘ret’ may be used uninitialized in this function

So we need to set a default value to ret here.
But a deep look at scsi_setup_discard_cmnd makes me think
of which value should be set. Now we have BLKPREP_KILL and
BLKPREP_DEFER to indicate an error. As in case of an
unknown sdkp->provisioning_mode, we goto out directly. So
I guess we should return BLKPREP_KILL here so that the allocated
page can be freed in the 'out'.

Cc: James Bottomley <James.Bottomley@...e.de>
Signed-off-by: Tao Ma <boyu.mt@...bao.com>
---
 drivers/scsi/sd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3be5db5..91564bd 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -541,7 +541,7 @@ static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
 	sector_t sector = bio->bi_sector;
 	unsigned int nr_sectors = bio_sectors(bio);
 	unsigned int len;
-	int ret;
+	int ret = BLKPREP_KILL;
 	char *buf;
 	struct page *page;
 
-- 
1.6.3.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ