Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2855595lqz; Wed, 3 Apr 2024 10:21:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVXclISC9RIS6nsfC8NuJBpR+ZxSIlPvlgtdnRgXVyOFW4xF4G00Kn697QiUI/+5zUtDhGYYYGgtry7ECdkbLTld9cj1lGBKVzMLRcbDA== X-Google-Smtp-Source: AGHT+IHKLsVS0e592xRYBIEamE1jMXZpuqjwReTBlS+VIAnZE9z1s7PnZCI/o/+Sn8HoyV1huBmI X-Received: by 2002:a05:6a00:92a6:b0:6ea:e2ed:497d with SMTP id jw38-20020a056a0092a600b006eae2ed497dmr199466pfb.19.1712164913861; Wed, 03 Apr 2024 10:21:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712164913; cv=pass; d=google.com; s=arc-20160816; b=LPwMSHRHuSq9wf2Md3vLwAhx7WWBmamc5xpPVGZnGRjena+JxrPs/EBoglCtUUhsAZ OIOsmLw8p5Xm6eXvAJCQjr0YZpQr4/ipliG1pTKlcy8Ils7g7obEhFZnoz/yCahRjDkV 7yK/ixsO/XQaFjQ2ywP88tlcT0zaIQT00E7qVXnIucZJWR/R3TQr76W2skaxBDAFgDOS 7LRDv0l3X2Xxc2+ML+YIgWFlwltePbf+LrP4fTl98wyK0wDBK/LM/CxsmL9EkbdZ/7yM tI6X7w8dIONBsBatHcuCb0h6oDKKF4wqZVJiwxroulXwvnjIhRsNAUFvlGSkR59NoIBW D6cw== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/+7/se9tC39y5iAijS62Z19tpAvcCLG/ConipRnEYCo=; fh=2U29iyHh8HISuuHe9+kPEjk0PdkMSMmM2qFAhANsdko=; b=AC6/MHqTe7Q2NkHzgCPZLDFpYtqeNECcl5cuaKS98hw2iRdLMXD6ZW6YvZvBNwGg9k yAwXconN7kcc+/ty0aaASPMtcGiyEWB5ptsmFghziesSN/wQpVW2rLw5PpEXtRBFBpgq lTqUknj6huK1tEd6kvoz/XjVsOJ8vGyxI72EQeCGwLhw+dQCKQrbdo27HmxjY4bbrgM5 Bq4TtCuvQS162BO5nmkGfFrf+CAO2n0VlPTQOtUb4kGVcLndCN5iR+j3NBaiu4KC7zKO /HFmKYMwh1RMuAzk9lYb957kVxbF8XJOliPQx/ubEPEAiZAOQUbhDup1lSuJciddGnXf IdIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y6P8eJXE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130275-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130275-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l17-20020a629111000000b006e698c1508dsi13071769pfe.71.2024.04.03.10.21.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 10:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130275-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y6P8eJXE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130275-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130275-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E9F0C28934B for ; Wed, 3 Apr 2024 17:19:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8973815383A; Wed, 3 Apr 2024 17:16:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y6P8eJXE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A749D152E18; Wed, 3 Apr 2024 17:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712164618; cv=none; b=F4Ggoc/bwRaD/nY/VcUkTxxVQA6+sRIuyFtKtj7K76sAakXIl2Ml4nwhE8h5WOit5f33L6AueZk1P1hqcUbeE5mVuVLn1wlziY6DI5WOzqpzAlC3bCHuT56qp2IibE4NbW9cvBX1iNoRcBGSp/BV7YFTfVyEylLDdqUCY+8U8K4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712164618; c=relaxed/simple; bh=eH6n/XrrBzShozVSMmjhzduWadISNU3nrGIZ3CDYUjo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ob1srrOqWBtCX57fJiC2DPh0urfWa2gCT4J1aDy7s+YXZ+bRU3tfCUQbQb+DSBndpvuMVmdxAdrRJKhZUROwCsdtv+7wK7Eu35aeweGOmJ+zEm1Uae7Go1HlYB9Cx8kAaWLsVEff2EADVGcAcpOFiNo1M45L/YkSdFWoEXEP3sU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y6P8eJXE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BC7BC43390; Wed, 3 Apr 2024 17:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712164618; bh=eH6n/XrrBzShozVSMmjhzduWadISNU3nrGIZ3CDYUjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6P8eJXE+SwVOWAzmioX0cUqXe1PUbnObn17dt88nRHYBGedO6Fdqr5CEW8UaLsa3 CvfUHO3mtnFfCH5PlMmIncw3yPnGXfaFGn+qRshJvhdOApnTwibHfEhoOB1v4foyxW CiO/3VhmIzRlv5Za1Se1q36kZCQco/DzYk0Qln7X4McL51KclYBpBrWiXes9Dv9w8t zs4Be3+M2JYOkdkAYdd/rjRHi17+J/ELIpr5JXB+SXSAgIM3DxitZTDjnYs79GygTN xXlerlrzIK4zNbD0nqoGGLG+5zZq0Ckmu0eOpXFLoTzBX1AurG3cLSOEnJ8uabxMV+ DnzsAFMP9/F4Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Karina Yankevich , Sergey Shtylyov , Alan Stern , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net Subject: [PATCH AUTOSEL 6.8 02/28] usb: storage: sddr55: fix sloppy typing in sddr55_{read|write}_data() Date: Wed, 3 Apr 2024 13:16:04 -0400 Message-ID: <20240403171656.335224-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240403171656.335224-1-sashal@kernel.org> References: <20240403171656.335224-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.3 Content-Transfer-Encoding: 8bit From: Karina Yankevich [ Upstream commit d6429a3555fb29f380c5841a12f5ac3f7444af03 ] In sddr55_{read|write}_data(), the address variables are needlessly typed as *unsigned long* -- which is 32-bit type on the 32-bit arches and 64-bit type on the 64-bit arches; those variables' value should fit into just 3 command bytes and consists of 10-bit block # (or at least the max block # seems to be 1023) and 4-/5-bit page # within a block, so 32-bit *unsigned* *int* type should be more than enough... Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool. [Sergey: rewrote the patch subject/description] Signed-off-by: Karina Yankevich Signed-off-by: Sergey Shtylyov Reviewed-by: Alan Stern Link: https://lore.kernel.org/r/4c9485f2-0bfc-591b-bfe7-2059289b554e@omp.ru Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/storage/sddr55.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c index 15dc25801cdcc..0aa079405d23c 100644 --- a/drivers/usb/storage/sddr55.c +++ b/drivers/usb/storage/sddr55.c @@ -196,7 +196,7 @@ static int sddr55_read_data(struct us_data *us, unsigned char *buffer; unsigned int pba; - unsigned long address; + unsigned int address; unsigned short pages; unsigned int len, offset; @@ -316,7 +316,7 @@ static int sddr55_write_data(struct us_data *us, unsigned int pba; unsigned int new_pba; - unsigned long address; + unsigned int address; unsigned short pages; int i; -- 2.43.0