linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sd: Free the page in case of unknown provisioning_mode in scsi_setup_discard_cmnd.
@ 2011-03-22  4:04 Tao Ma
  2011-03-22 12:57 ` Jeff Moyer
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Ma @ 2011-03-22  4:04 UTC (permalink / raw)
  To: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

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

This patch is inspired by a build waring.
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 and free the page.

Signed-off-by: Tao Ma <boyu.mt@taobao.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sd: Free the page in case of unknown provisioning_mode in scsi_setup_discard_cmnd.
  2011-03-22  4:04 [PATCH] sd: Free the page in case of unknown provisioning_mode in scsi_setup_discard_cmnd Tao Ma
@ 2011-03-22 12:57 ` Jeff Moyer
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Moyer @ 2011-03-22 12:57 UTC (permalink / raw)
  To: Tao Ma; +Cc: linux-kernel

Tao Ma <tm@tao.ma> writes:

> From: Tao Ma <boyu.mt@taobao.com>
>
> This patch is inspired by a build waring.
> 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 and free the page.

Yeah, there's no point in deferring it.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-22 12:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-22  4:04 [PATCH] sd: Free the page in case of unknown provisioning_mode in scsi_setup_discard_cmnd Tao Ma
2011-03-22 12:57 ` Jeff Moyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).