Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1628545
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] mtip32xx: Uninitialized variable in mtip_no_dev_cleanup() |
| Date | 2017-04-21 21:40 +0200 |
| Message-ID | <tyMzn-1ke-1@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
We set "cmd->state = -ENODEV;" but "cmd" hasn't been initialized yet.
It's weird that GCC doesn't catch this.
Fixes: 4dda4735c581 ("mtip32xx: add a status field to struct mtip_cmd")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Not tested, please review carefully.
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 66a6bd83faae..bd4bf70a5bcd 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4105,14 +4105,12 @@ static int mtip_block_initialize(struct driver_data *dd)
static void mtip_no_dev_cleanup(struct request *rq, void *data, bool reserv)
{
struct driver_data *dd = (struct driver_data *)data;
- struct mtip_cmd *cmd;
+ struct mtip_cmd *cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL);
if (likely(!reserv)) {
cmd->status = -ENODEV;
blk_mq_complete_request(rq);
} else if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &dd->port->flags)) {
-
- cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL);
if (cmd->comp_func)
cmd->comp_func(dd->port, MTIP_TAG_INTERNAL,
cmd, -ENODEV);
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] mtip32xx: Uninitialized variable in mtip_no_dev_cleanup() Dan Carpenter <dan.carpenter@oracle.com> - 2017-04-21 21:40 +0200
csiph-web