Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1622963 > unrolled thread
| Started by | Jan Glauber <jglauber@cavium.com> |
|---|---|
| First post | 2017-04-13 14:20 +0200 |
| Last post | 2017-04-13 14:20 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/2] mmc: cavium: Check pointer before de-reference Jan Glauber <jglauber@cavium.com> - 2017-04-13 14:20 +0200
| From | Jan Glauber <jglauber@cavium.com> |
|---|---|
| Date | 2017-04-13 14:20 +0200 |
| Subject | [PATCH 2/2] mmc: cavium: Check pointer before de-reference |
| Message-ID | <tvLTc-2Sx-11@gated-at.bofh.it> |
Add a pointer check to prevent this smatch warning: drivers/mmc/host/cavium.c:803 cvm_mmc_request() error: we previously assumed 'cmd->data' could be null (see line 782) This is a theoretical fix because MMC_CMD_ADTC seems to imply that cmd->data is not null. Nevertheless checking cmd->data before using it improves readability. Signed-off-by: Jan Glauber <jglauber@cavium.com> --- drivers/mmc/host/cavium.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c index ddf902c..d89c2eb 100644 --- a/drivers/mmc/host/cavium.c +++ b/drivers/mmc/host/cavium.c @@ -799,7 +799,7 @@ static void cvm_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) FIELD_PREP(MIO_EMM_CMD_IDX, cmd->opcode) | FIELD_PREP(MIO_EMM_CMD_ARG, cmd->arg); set_bus_id(&emm_cmd, slot->bus_id); - if (mmc_cmd_type(cmd) == MMC_CMD_ADTC) + if (cmd->data && mmc_cmd_type(cmd) == MMC_CMD_ADTC) emm_cmd |= FIELD_PREP(MIO_EMM_CMD_OFFSET, 64 - ((cmd->data->blocks * cmd->data->blksz) / 8)); -- 2.9.0.rc0.21.g7777322
Back to top | Article view | linux.kernel
csiph-web