[PATCH] Check whether divisor is non-zero before division

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since uzonesize may be zero, so a judgement for non-zero is nessesary.

Reported-by: xingwei lee <xrivendell7@xxxxxxxxx>
Reported-by: yue sun <samsun1006219@xxxxxxxxx>
Signed-off-by: Shichao Lai <shichaorai@xxxxxxxxx>
---
 drivers/usb/storage/alauda.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 115f05a6201a..db075a8c03cb 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -947,6 +947,8 @@ static int alauda_read_data(struct us_data *us, unsigned long address,
 	sg = NULL;
 
 	while (sectors > 0) {
+		if (!uzonesize)
+			return USB_STOR_TRANSPORT_ERROR;
 		unsigned int zone = lba / uzonesize; /* integer division */
 		unsigned int lba_offset = lba - (zone * uzonesize);
 		unsigned int pages;
-- 
2.34.1





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux