Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp820504lqp; Thu, 23 May 2024 00:23:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXfY6MlfWGe+b8x8N5g8vXyvV70tVf8RZQYQ34MSc3sSuKJ+/WE1dd0xg11QL+4Jlcx+vw1fGnstjrjru+F6TnWSJtx5tlosWZaRBDthw== X-Google-Smtp-Source: AGHT+IHrDWJpK/5sklL5PcVgSQX/n2TGKvhfRZkPtHmG69b6o+Sb1IUWbhGUgBN4grFhyNfP+HUY X-Received: by 2002:a05:622a:e:b0:43e:38c6:6cf9 with SMTP id d75a77b69052e-43f9e0c33dbmr47535441cf.23.1716449013170; Thu, 23 May 2024 00:23:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716449013; cv=pass; d=google.com; s=arc-20160816; b=ch4HnrOEQx89xYRbVCCzAItIkbA7GTpH+inM2VMl+hNqXtIm0OKpR50icVzTq7V2cv rOB1LiFLMMCfpsECiUdsPhY3zwP/HWmwDyoHpEyJvUVstB+fLUvjBLAiK4Brzo938jo1 rikZWRL2CGEumMOXWz4MXOfyvpp3LFcJMPSnlLTv0+MxSsWl8jggR5MFGQZLDF+Xf9tb A3efBlc/buAwYF6bOQpvbpZgljBbVx5ENZXVQJ+e80Ccm8sh5ThMNZVS6tiTHtEw7s1J gnlh+8nYJPVqvuzClQOp9IgXIcIw09U0LsihN/WsD761oGhLzfTU725tYHAnrDqu3bkV u1EA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=rq5A7qawIz0cEKS1QsmbeowUJYNK+rwYbjhoZojg+Kk=; fh=3Q19Xe7Sr0sOkwXbGNDJm+9Ugw9LO1rWFWSx29UmXB0=; b=srBujqY0YvOzpE8wY5A5GbYEHxsbWMPg3Lm5Ig6xLN2TzCUlFhZjqF5gu2pzCxpn4W xjsFq8+sQOoV4T4DGNDh/nV6uYWDrvsXSuULW0OM6Ap8IZh5RtmpUO6SxwhSKH8nKORf 9aEj87UfEpilCrUm8skyT8TnSAPTvdTEHToxlEry8mDHBjHnJ8bwlH+x1MG2hTl0Mbls s75e4ysD4FTt1I4DA8LgE+BZVVcfvrg0PBFVAWOb9yTHEh1KfMUjNlIb2BcuoL4hz/RO VtD29c+MmV0ifNMoOM4QR5MoghTftJLSL38xi64vdif8LW0YggfMNff6tbI9w+SzPcwn sTyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Tzv3DL9Y; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-187087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187087-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6aa5d6f9d72si6796446d6.509.2024.05.23.00.23.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 00:23:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Tzv3DL9Y; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-187087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187087-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E06D21C2122D for ; Thu, 23 May 2024 07:23:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44E8B13CA91; Thu, 23 May 2024 07:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Tzv3DL9Y" Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 396C013C677; Thu, 23 May 2024 07:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716449004; cv=none; b=nL0lfgcHS5G7VCn4oo+XsxW0TJ3cNtkWQ1c86pXrY6DgHu4ht9TKD/F1/HOEytQZTRgjmMCuSt3jrHyDOdj6JkbvK1bRrOLDrQlpGmI+57qg7vwVzWVMWeu6RbchUdgHo7HfW8tkUVLGSDcLlrPd/3nMk9g12hdK0oYonSZr6S8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716449004; c=relaxed/simple; bh=vK4pezd55jcyKV1ONSHi+cBOCH1OBx7KMPkopav6q5I=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=frDIwqXr0zMZchtFXU3IEVnI+6c+D9LgYUz+iifscBnTYzUH3aS5ze/10PgA2ZrhjSsbZSpUJ+MkT11BSmKhksi9PeTS/MLVlkhkbaZ5O0OFhF2EPof8u5xPJPiVDuaY/VmGXmCHp+k/QDVQKW64A/hnnD/Sjdf9Tz9HXFfBCg4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Tzv3DL9Y; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6f6a045d476so1980947b3a.1; Thu, 23 May 2024 00:23:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716449002; x=1717053802; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rq5A7qawIz0cEKS1QsmbeowUJYNK+rwYbjhoZojg+Kk=; b=Tzv3DL9Yj8lhL3SFTdgFNHoDk7lDDNdffTOpzzsXoo32/0vgrX78vWIPpJ+H7d9Uku OD7y4nW0CydeGIw5uUp2jIl+04nzTV1x0he+WBJl2kEsLWmDoaqRQnhtz8ctIMY+5DZL IFgvSudDJ9SKtQZ2Nhpug/YS6O9UqosrlEY19beyN+3na1oPTOJ5/ZrCkabXTFNCaXHF 8Sr+inP+IcOKFRJqJXI1YH1BgAGfa0inXiqLLr1/NZo0RQv5pm8DWk2mywpJLa70raJB Zh+feHVrf2fKekYRp88detGfKxHJosm4bAQb5QKXjpYdxifp3cufigLNkE7Jst8h0Ktj 2R4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716449002; x=1717053802; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rq5A7qawIz0cEKS1QsmbeowUJYNK+rwYbjhoZojg+Kk=; b=RgMq7t5xKUae+aPWhiDKLvoCUN8wyFmg1soHVD0T0iIMfJ6G2f34/3Ysnse5Z23C5H EuaJvl1IILYWu4k8Ro30OeN/hNVc2h1TaMdV2idxR4MhQWi/2cDZVZGvtbbl8fK3nq/0 bVye80bSHed5bxNm/H1rLKbbArQNjjuV4V7AA2GQ53Ebz7tXnZWBdaG0cpd8IDUZohCf c7rWSqm0UcAJh3neqiXwxhBhF+EMbYiTRPJfAAO+1XA7vcshNrhFtgS4UHwgkMVbcyP+ o7aGndMMJKkKqF9+hND2kBstQ0AWk45lxUhMt6bu//QN+ALDiqBSq2NBIxs0rxcjzHOH bpig== X-Forwarded-Encrypted: i=1; AJvYcCUkDgeyU/9MLTzGAEQqubVUUN+ZZJXcsPhrbVKJXnIMKCIEd9WEZHLCdLDgCGCE3bYAY6gxxAHGybx2uzDZRglTeyDQMDNAxIHFGuBB X-Gm-Message-State: AOJu0YymtY6YmBOP/9fxcblQKMfpbUFoIZbUKvFXPDqb7M9DHqTfqOi5 YP2hmlomMdM6Tzh11v45T0dWr+hqqBGED/34Eus57qt6eHxt04r3pDJVn2HrMUUgnA== X-Received: by 2002:a05:6a00:acd:b0:6f3:88c5:fed6 with SMTP id d2e1a72fcca58-6f6d60ca8b7mr4509744b3a.19.1716449002429; Thu, 23 May 2024 00:23:22 -0700 (PDT) Received: from velvet.. ([111.42.148.111]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b2fe07sm23453154b3a.216.2024.05.23.00.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 00:23:22 -0700 (PDT) From: Shichao Lai To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, linux-kernel@vger.kernel.org, Shichao Lai , xingwei lee , yue sun Subject: [PATCH] Check whether divisor is non-zero before division Date: Thu, 23 May 2024 15:22:42 +0800 Message-Id: <20240523072242.787164-1-shichaorai@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since uzonesize may be zero, so a judgement for non-zero is nessesary. Reported-by: xingwei lee Reported-by: yue sun Signed-off-by: Shichao Lai --- 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