mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-20 06:52:18 +00:00
Fixing NULL pointer dereferences accessing dev->d_sense
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@706 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+1
-1
@@ -2407,7 +2407,7 @@ static inline int scst_cmd_aborted(struct scst_cmd *cmd)
|
||||
/* Returns sense data format for cmd's dev */
|
||||
static inline bool scst_get_cmd_dev_d_sense(struct scst_cmd *cmd)
|
||||
{
|
||||
return cmd->dev->d_sense;
|
||||
return (cmd->dev != NULL) ? cmd->dev->d_sense : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -141,8 +141,8 @@ void scst_set_cmd_error(struct scst_cmd *cmd, int key, int asc, int ascq)
|
||||
goto out;
|
||||
}
|
||||
|
||||
scst_set_sense(cmd->sense, SCST_SENSE_BUFFERSIZE, cmd->dev->d_sense,
|
||||
key, asc, ascq);
|
||||
scst_set_sense(cmd->sense, SCST_SENSE_BUFFERSIZE,
|
||||
scst_get_cmd_dev_d_sense(cmd), key, asc, ascq);
|
||||
TRACE_BUFFER("Sense set", cmd->sense, SCST_SENSE_BUFFERSIZE);
|
||||
|
||||
out:
|
||||
|
||||
Reference in New Issue
Block a user