summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2017-07-05 17:09:42 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2017-07-11 16:27:49 +0200
commitaab2ee03912be6e12bb5f4810be0b80a82168d3e (patch)
treef6f30ccccfdcb24eb20586c6a84b3416cd040645 /drivers/mmc/core
parent7432b49b54cd931743f0b6e9f652bc329e4a242a (diff)
downloadop-kernel-dev-aab2ee03912be6e12bb5f4810be0b80a82168d3e.zip
op-kernel-dev-aab2ee03912be6e12bb5f4810be0b80a82168d3e.tar.gz
mmc: block: Let MMC_IOC_MULTI_CMD return zero again for zero entries
With gcc 4.1.2: drivers/mmc/core/block.c: In function ‘mmc_blk_ioctl_cmd_issue’: drivers/mmc/core/block.c:630: warning: ‘ioc_err’ may be used uninitialized in this function Indeed, if mq_rq->ioc_count is zero, an uninitialized value will be stored in mq_rq->drv_op_result and passed to blk_end_request_all(). Can mq_rq->ioc_count be zero? - mmc_blk_ioctl_cmd() sets ioc_count to 1, so this is safe, - mmc_blk_ioctl_multi_cmd() obtains ioc_count from user space in response to the MMC_IOC_MULTI_CMD ioctl, and does allow zero. To avoid returning an uninitialized value, and as it is pointless to do all this work when the MMC_IOC_MULTI_CMD ioctl is used with zero entries, check for this early in mmc_blk_ioctl_multi_cmd(), and return zero, like was returned before. Fixes: 3ecd8cf23f88d5df ("mmc: block: move multi-ioctl() to use block layer") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/block.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 4920ea1..e036322 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -637,6 +637,9 @@ static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev,
sizeof(num_of_cmds)))
return -EFAULT;
+ if (!num_of_cmds)
+ return 0;
+
if (num_of_cmds > MMC_IOC_MAX_CMDS)
return -EINVAL;
OpenPOWER on IntegriCloud