From 5240aa6fcb21846aadd5bb98dfd2eb0e69e1cf09 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 7 Mar 2019 00:00:13 -0800 Subject: usb: storage: Don't use "unsigned long" for 32-bit values Unsignled long will expand to 64-bit unsigned integer on 64-bit CPUs. This will break current code using it to read out two 32-bit values returned by READ_CAPACITY. Fix the proble by using "u32" explicitly. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/usb/storage/usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 89a80c4839..db839e39a2 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -322,7 +322,7 @@ static int usb_stor_init_blkdev(struct us_blk_dev *pblk_dev) struct us_data *us = pblk_dev->us; struct device_d *dev = &us->pusb_dev->dev; ccb us_ccb; - unsigned long *pcap; + u32 *pcap; int result = 0; us_ccb.pdata = us_io_buf; @@ -363,8 +363,8 @@ static int usb_stor_init_blkdev(struct us_blk_dev *pblk_dev) result = -EIO; goto Exit; } - pcap = (unsigned long *)us_ccb.pdata; - dev_dbg(dev, "Read Capacity returns: 0x%lx, 0x%lx\n", pcap[0], pcap[1]); + pcap = (u32 *)us_ccb.pdata; + dev_dbg(dev, "Read Capacity returns: 0x%x, 0x%x\n", pcap[0], pcap[1]); pblk_dev->blk.num_blocks = usb_limit_blk_cnt(be32_to_cpu(pcap[0]) + 1); if (be32_to_cpu(pcap[1]) != SECTOR_SIZE) pr_warn("Support only %d bytes sectors\n", SECTOR_SIZE); -- cgit v1.2.3