diff mbox

[1,03/25] hpsa: check for null arguments to dev_printk

Message ID 20151028220447.5323.79638.stgit@brunhilda (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Don Brace Oct. 28, 2015, 10:04 p.m. UTC
Check for NULLs.

Signed-off-by: Don Brace <don.brace@pmcs.com>
---
 drivers/scsi/hpsa.c |    6 ++++++
 drivers/scsi/hpsa.h |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tomas Henzl Oct. 29, 2015, 1:41 p.m. UTC | #1
On 28.10.2015 23:04, Don Brace wrote:
> Check for NULLs.

How is the devtype change related to this?

Please next time use separated patch for every change.

Reviewed-by: Tomas Henzl <thenzl@redhat.com>

Cheers,
Tomas

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Manoj Kumar Oct. 29, 2015, 2:41 p.m. UTC | #2
On 10/28/2015 5:04 PM, Don Brace wrote:
> Check for NULLs.
> -	int devtype;
> +	unsigned int devtype;

Don:

Unrelated to the NULL argument check. Would have been preferable in a
distinct patch.

Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com>

---
Manoj Kumar


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hannes Reinecke Oct. 30, 2015, 7:47 a.m. UTC | #3
On 10/28/2015 11:04 PM, Don Brace wrote:
> Check for NULLs.
> 
> Signed-off-by: Don Brace <don.brace@pmcs.com>
> ---
>  drivers/scsi/hpsa.c |    6 ++++++
>  drivers/scsi/hpsa.h |    2 +-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 864fb03..6b6e9bb 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -1139,6 +1139,12 @@ static int hpsa_find_target_lun(struct ctlr_info *h,
>  static inline void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
>  	struct hpsa_scsi_dev_t *dev, char *description)
>  {
> +	if (dev == NULL)
> +		return;
> +
> +	if (h == NULL || h->pdev == NULL || h->scsi_host == NULL)
> +		return;
> +
>  	dev_printk(level, &h->pdev->dev,
>  			"scsi %d:%d:%d:%d: %s %s %.8s %.16s RAID-%s SSDSmartPathCap%c En%c Exp=%d\n",
>  			h->scsi_host->host_no, dev->bus, dev->target, dev->lun,
> diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
> index 27debb3..d6c4ebf 100644
> --- a/drivers/scsi/hpsa.h
> +++ b/drivers/scsi/hpsa.h
> @@ -34,7 +34,7 @@ struct access_method {
>  };
>  
>  struct hpsa_scsi_dev_t {
> -	int devtype;
> +	unsigned int devtype;
>  	int bus, target, lun;		/* as presented to the OS */
>  	unsigned char scsi3addr[8];	/* as presented to the HW */
>  #define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0"
> 
That's not really a check for NULL, isn't it?
Should rather be moved into an individual patch.

Cheers,

Hannes
Don Brace Oct. 30, 2015, 2:16 p.m. UTC | #4
On 10/30/2015 02:47 AM, Hannes Reinecke wrote:
> On 10/28/2015 11:04 PM, Don Brace wrote:
>> Check for NULLs.
>>
>> Signed-off-by: Don Brace <don.brace@pmcs.com>
>> ---
>>   drivers/scsi/hpsa.c |    6 ++++++
>>   drivers/scsi/hpsa.h |    2 +-
>>   2 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
>> index 864fb03..6b6e9bb 100644
>> --- a/drivers/scsi/hpsa.c
>> +++ b/drivers/scsi/hpsa.c
>> @@ -1139,6 +1139,12 @@ static int hpsa_find_target_lun(struct ctlr_info *h,
>>   static inline void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
>>   	struct hpsa_scsi_dev_t *dev, char *description)
>>   {
>> +	if (dev == NULL)
>> +		return;
>> +
>> +	if (h == NULL || h->pdev == NULL || h->scsi_host == NULL)
>> +		return;
>> +
>>   	dev_printk(level, &h->pdev->dev,
>>   			"scsi %d:%d:%d:%d: %s %s %.8s %.16s RAID-%s SSDSmartPathCap%c En%c Exp=%d\n",
>>   			h->scsi_host->host_no, dev->bus, dev->target, dev->lun,
>> diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
>> index 27debb3..d6c4ebf 100644
>> --- a/drivers/scsi/hpsa.h
>> +++ b/drivers/scsi/hpsa.h
>> @@ -34,7 +34,7 @@ struct access_method {
>>   };
>>   
>>   struct hpsa_scsi_dev_t {
>> -	int devtype;
>> +	unsigned int devtype;
>>   	int bus, target, lun;		/* as presented to the OS */
>>   	unsigned char scsi3addr[8];	/* as presented to the HW */
>>   #define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0"
>>
> That's not really a check for NULL, isn't it?
> Should rather be moved into an individual patch.
>
> Cheers,
>
> Hannes

Making the change.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 864fb03..6b6e9bb 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -1139,6 +1139,12 @@  static int hpsa_find_target_lun(struct ctlr_info *h,
 static inline void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
 	struct hpsa_scsi_dev_t *dev, char *description)
 {
+	if (dev == NULL)
+		return;
+
+	if (h == NULL || h->pdev == NULL || h->scsi_host == NULL)
+		return;
+
 	dev_printk(level, &h->pdev->dev,
 			"scsi %d:%d:%d:%d: %s %s %.8s %.16s RAID-%s SSDSmartPathCap%c En%c Exp=%d\n",
 			h->scsi_host->host_no, dev->bus, dev->target, dev->lun,
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index 27debb3..d6c4ebf 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -34,7 +34,7 @@  struct access_method {
 };
 
 struct hpsa_scsi_dev_t {
-	int devtype;
+	unsigned int devtype;
 	int bus, target, lun;		/* as presented to the OS */
 	unsigned char scsi3addr[8];	/* as presented to the HW */
 #define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0"