mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-11 00:08:50 +00:00
drivers/mmc: Move dereference after NULL test
If the NULL test on mrq is needed, then the derefernce should be after the NULL test. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // <smpl> @match exists@ expression x, E; identifier fld; @@ * x->fld ... when != \(x = E\|&x\) * x == NULL // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4ec6496065
commit
3423d80af6
@ -820,7 +820,7 @@ fail_request:
|
|||||||
static void finalize_request(struct s3cmci_host *host)
|
static void finalize_request(struct s3cmci_host *host)
|
||||||
{
|
{
|
||||||
struct mmc_request *mrq = host->mrq;
|
struct mmc_request *mrq = host->mrq;
|
||||||
struct mmc_command *cmd = host->cmd_is_stop ? mrq->stop : mrq->cmd;
|
struct mmc_command *cmd;
|
||||||
int debug_as_failure = 0;
|
int debug_as_failure = 0;
|
||||||
|
|
||||||
if (host->complete_what != COMPLETION_FINALIZE)
|
if (host->complete_what != COMPLETION_FINALIZE)
|
||||||
@ -828,6 +828,7 @@ static void finalize_request(struct s3cmci_host *host)
|
|||||||
|
|
||||||
if (!mrq)
|
if (!mrq)
|
||||||
return;
|
return;
|
||||||
|
cmd = host->cmd_is_stop ? mrq->stop : mrq->cmd;
|
||||||
|
|
||||||
if (cmd->data && (cmd->error == 0) &&
|
if (cmd->data && (cmd->error == 0) &&
|
||||||
(cmd->data->error == 0)) {
|
(cmd->data->error == 0)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user