From nobody Sun Feb 8 05:20:07 2026 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (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 CAD04381B0 for ; Thu, 29 Feb 2024 03:47:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709178480; cv=none; b=Jqykveq5XtZhJj0TW5c07ZES3ie2jaR5SgXLWuYZiTd6YsptwiGdHx8zE+yvDguJN37cbd0ivxJ3JsV0OkPLdg/V5Oe6LoLQT142FeOxtMRKwZpEbpDte7zlT2U5arx377vGmi3O3jqH72phiarixIQH2KN77kgh6ImPszF9Kms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709178480; c=relaxed/simple; bh=fp3Mxq2ltzt6MMHBtz4FN6pPfnR8KvUSOwgEwxPR6nU=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=j23maUC8dwDR5+shP19xqM1JmwrAoQs19CYy/aCljJHdbgFf+7GENfZ4qKMbDVMYlmJIsIRACvxt28+SRmao0+YupU3CkqXT/mUeF0opQS8sAClFkE37YNZLaIbMC3paIRMi6pETh0Ynn+VwE2TPAWoKBDqHjdE2ax2LVsodWTI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rfXOM-0006Wc-2B; Thu, 29 Feb 2024 03:47:30 +0000 Date: Thu, 29 Feb 2024 03:47:24 +0000 From: Daniel Golle To: Richard Weinberger , Zhihao Cheng , Miquel Raynal , Vignesh Raghavendra , Daniel Golle , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] mtd: ubi: fix NVMEM over UBI volumes on 32-bit systems Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A compiler warning related to sizeof(int) !=3D 8 when calling do_div() is triggered when building on 32-bit platforms. Address this by using integer types having a well-defined size. Fixes: 3ce485803da1 ("mtd: ubi: provide NVMEM layer over UBI volumes") Signed-off-by: Daniel Golle Reviewed-by: Zhihao Cheng Tested-by: Randy Dunlap --- v3: use size_t also for 'to_read' variable to avoid truncation (no problem in practise beyond the compiler warning) v2: use size_t for 'bytes_left' variable to match parameter type drivers/mtd/ubi/nvmem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/nvmem.c b/drivers/mtd/ubi/nvmem.c index b7a93c495d172..8aeb9c428e510 100644 --- a/drivers/mtd/ubi/nvmem.c +++ b/drivers/mtd/ubi/nvmem.c @@ -23,9 +23,12 @@ struct ubi_nvmem { static int ubi_nvmem_reg_read(void *priv, unsigned int from, void *val, size_t bytes) { - int err =3D 0, lnum =3D from, offs, bytes_left =3D bytes, to_read; + size_t to_read, bytes_left =3D bytes; struct ubi_nvmem *unv =3D priv; struct ubi_volume_desc *desc; + uint32_t offs; + uint64_t lnum =3D from; + int err =3D 0; =20 desc =3D ubi_open_volume(unv->ubi_num, unv->vol_id, UBI_READONLY); if (IS_ERR(desc)) --=20 2.44.0