diff mbox series

scsi: Correct-the-type-of-arg-to-scsi_host_lookup

Message ID 1589531416-3852-1-git-send-email-gulam.mohamed@oracle.com (mailing list archive)
State Changes Requested
Headers show
Series scsi: Correct-the-type-of-arg-to-scsi_host_lookup | expand

Commit Message

Gulam Mohamed May 15, 2020, 8:30 a.m. UTC
The data type of the argument, hostnum, to function
scsi_host_lookup(unsigned short hostnum) is unsigned short but the
hostnum sent to this function from callers functions is uint32_t or
unsigned int. Correct the data type to unsigned int to avoid the
wrapping of the hostnum value after 65535. Also change the data type of
local variable hostnum of the function __scsi_host_match() to unsigned
int.

Signed-off-by: Gulam Mohamed <gulam.mohamed@oracle.com>
Reviewed-by: Joe Jin <joe.jin@oracle.com>
Reviewed-by: Fred Herard <fred.herard@oracle.com>
---
 drivers/scsi/hosts.c     | 4 ++--
 include/scsi/scsi_host.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 7ec91c3a66ca..c5c1534eb6e7 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -510,7 +510,7 @@  struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 static int __scsi_host_match(struct device *dev, const void *data)
 {
 	struct Scsi_Host *p;
-	const unsigned short *hostnum = data;
+	const unsigned int *hostnum = data;
 
 	p = class_to_shost(dev);
 	return p->host_no == *hostnum;
@@ -527,7 +527,7 @@  static int __scsi_host_match(struct device *dev, const void *data)
  *	that scsi_host_get() took. The put_device() below dropped
  *	the reference from class_find_device().
  **/
-struct Scsi_Host *scsi_host_lookup(unsigned short hostnum)
+struct Scsi_Host *scsi_host_lookup(unsigned int hostnum)
 {
 	struct device *cdev;
 	struct Scsi_Host *shost = NULL;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 822e8cda8d9b..59742fb6fcd7 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -731,7 +731,7 @@  extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *,
 extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
 extern int scsi_host_busy(struct Scsi_Host *shost);
 extern void scsi_host_put(struct Scsi_Host *t);
-extern struct Scsi_Host *scsi_host_lookup(unsigned short);
+extern struct Scsi_Host *scsi_host_lookup(unsigned int);
 extern const char *scsi_host_state_name(enum scsi_host_state);
 extern void scsi_host_complete_all_commands(struct Scsi_Host *shost,
 					    int status);