From patchwork Wed Feb 28 00:46:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 207563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3070813dyb; Tue, 27 Feb 2024 17:23:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUHkDbXCqDLzuyQtVqeSpa46mCt+vfSSUXYl47zhTyl+GjmigeUsHaKGRYpQyVbF+T3AGxm3If1OWCM2xjpk0VqwrWW2A== X-Google-Smtp-Source: AGHT+IFUdKMEEMxAsvhEbZGwXTc26R89xMpNdsfy0LYfBgOrUbzsiD+MKdQnNSEq9Mr14YrqUQqu X-Received: by 2002:a17:90a:af87:b0:29a:7380:53a with SMTP id w7-20020a17090aaf8700b0029a7380053amr10327142pjq.34.1709083384382; Tue, 27 Feb 2024 17:23:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709083384; cv=pass; d=google.com; s=arc-20160816; b=0QOoExilymLnKLWDqSKqfFM8Nn3eG/Av1LO1vZl2F45DDeqailBKUn8vMoSYGn7ZqT HyC5MEC2B7XCjeCU5yGXJd3gb9h6CisBhYn/zKzOQzn3/ZNmn4pT7FMdxbgRZbg09j4D uOjiuXO7tzogJiGhfxU33jYwEc6is4+EH9kM/eZJQo9Z4tP6diwJ9KcKr4+tcmWBBUXf NerxOMW28DSS5RKQQEzMp1v1BomhdsxB5t4zjanpWfgSvKzZ8/k+ISaoseLgWXEbVpsS L+ELqxIXVcFYyL9z89k3gWtDNu5SpmCE09gOj31gFwTaQ6Ccw4IV5Mr02tFeaaELG/Ft A4Gg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:to:from:date; bh=J3Bu8JTIzzZSnH1J1fogGkyRBvWttfR6sVWFfC86+sU=; fh=hR6DOXMpV/QGp1KiEfO/RpXoONraJJjwivRjZE+6NAY=; b=Hit9eMEi+jBYpgWSYyGgJ9Y2qPN2zxVttX6tgOdzEN5lSlrV49O510D02h3Qs4Y2J5 dntCLsfoNYZrsafQdpPjw/FEz0ZMRCB0gke7yjhNjjQGIYoodZDHobwe6L8C6vdFYEdY YP1URWbEGgnzJPnMrAbi3+ECB4BUBpnmy8PC0Gf1aea5jkTEpXZPThzfU/S1EO575V5n xmKBiPkR1pSOkK+hUaw4TtPS+2kwww/VPZdsnAxg6Wg71hqkhvV7/Sonbr3SrK263sL/ VqbQEDgc63pEWRPAdtn1NLBZd4TClp/iz289Asg0S7W/Ji+9CbNOu9m384G4jqXz88Ku 9WdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-84282-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84282-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id pt3-20020a17090b3d0300b0029ac667ef8csi365805pjb.10.2024.02.27.17.23.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:23:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84282-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-84282-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84282-ouuuleilei=gmail.com@vger.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 89BAFB23B12 for ; Wed, 28 Feb 2024 00:46:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8A4223CB; Wed, 28 Feb 2024 00:46:36 +0000 (UTC) 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 7982B15C9 for ; Wed, 28 Feb 2024 00:46:30 +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=1709081195; cv=none; b=N5mURDmEfrJyHdb3gNmMvvCkW3/PQgCq15rMCVw01nYclIPhCtOjY0XOcR5H3OzKZPEFSauskbizTuYm8vgtI7GtkHCRUZBeEFC1eYrb0J/Xps6pIShy6Y5VGmBWj/cVF2kOBdqaJWUYn0NcNoKudZ5VseqlNWV2XhS87mPyxC0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709081195; c=relaxed/simple; bh=wHMoY/Fu3WscBFDvhxwVyrzCbhR7WmpELJg60ziJok4=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=IsgjDklomyF2TRnl01TeQDjaxzpCRdvNB+bewXARK2z7Q54DQ2zucQ3uEo99lqKgRXSrC5YSU8hiQJ64UXW+4TVlFk8L3gfEuynUgZTqKYw8v5rNsIlBtrH9VOT/KHTF7PX1WLJN9K9eWCkrsRGuZwMkuHL1BWzlp9LmEWX9VkQ= 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 1rf85L-0002GY-1d; Wed, 28 Feb 2024 00:46:11 +0000 Date: Wed, 28 Feb 2024 00:46:02 +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 v2] mtd: ubi: fix NVMEM over UBI volumes on 32-bit systems Message-ID: <31a20aead3419209991bf01aaeaefe07ab94d23a.1709081052.git.daniel@makrotopia.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791989389163974636 X-GMAIL-MSGID: 1792103819153899599 A compiler warning related to sizeof(int) != 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 --- 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..e68b8589c4279 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 = 0, lnum = from, offs, bytes_left = bytes, to_read; struct ubi_nvmem *unv = priv; struct ubi_volume_desc *desc; + size_t bytes_left = bytes; + uint32_t offs, to_read; + uint64_t lnum = from; + int err = 0; desc = ubi_open_volume(unv->ubi_num, unv->vol_id, UBI_READONLY); if (IS_ERR(desc))