Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1496317rbb; Mon, 26 Feb 2024 11:03:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWECGOQlQQ05cQSm4XxrmpJbGnHUv48ROYYlCwtHqgknanhIn1mkTq2jtYbrGZ7vlTthkL+0mLL2QmybzdVxrD9MwovWLfAjWIhnfQr+A== X-Google-Smtp-Source: AGHT+IHKVY5twa42XPxkn8M4WQ83xeOSpsdvctj4BimYtJurBPTQLqqB29K6Rfngx1wq9d2ClhRn X-Received: by 2002:a05:6e02:ed2:b0:365:2ffc:b747 with SMTP id i18-20020a056e020ed200b003652ffcb747mr7634715ilk.17.1708974226217; Mon, 26 Feb 2024 11:03:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708974226; cv=pass; d=google.com; s=arc-20160816; b=ygIrXqLNAIcO8biRrZIzQcWTJdJlbLYEzmbkx6IGod0J2DBJFl/Y6fIkWOlFi/Qn2M WzCFZ7KH+d8ns9h1kT3ZFCAUMwB3rraF4gGS3w0grpmWWKwFMA1azkkVCzy9LMWqQLX0 CfkM+IxGhPpa4pDYcHa/dlMszQ7EC//QkGqYvm6LVSAZSAZAglILZyBDJYOTkYEpLEDR FY3WMPKIZUBIw3ChIImtR294VqXGP/0m3TrRrCO7KzT1gUqwnfHs2kJExJreBHdwXONQ pgNcR+6gzifsjdPZPRxynEQxRQEu0ag64XZy3WFXZxII9QwCLsN/7GRpO56eE7iL+ajG OPJw== 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=zxtpsdgmhdRZw1vL2h5bsjgUhyYt0FIkzr6NJ91XTkI=; fh=hR6DOXMpV/QGp1KiEfO/RpXoONraJJjwivRjZE+6NAY=; b=zIHsrOrpW0npvYWSS7HUG+w8VHCvKASLQsusHrQisdGJpsF/JVNPUQuxsJihv/kIDR hqAMOkFnYKaDsAejvdFrzWeNRTLUy8hWYhijlOa0F/D3keG7UEkBYQwwKFqZEBgoyHhL c1wpZO3wEIgJUh3IA51LvCeGYl+/s8PAX2Y113uA96b3Axjh26ZCWp7KaH+ivYjEQWKc QY45y3uocw+bY0rr19ZJ8hDxkPThgwnl9QPX3nd+rxWbUHQApehlQ0w16nkELFmOHfkL 7E4bEGyuj3HGQrtU9oexEdnQo94ARbY6zIHCsb8cnFbek/jVvnWCvOZCuUedIBI/b2r1 v03Q==; 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-82135-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82135-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i4-20020a636d04000000b005cdf88fbc11si4176705pgc.48.2024.02.26.11.03.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 11:03:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82135-linux.lists.archive=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-82135-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82135-linux.lists.archive=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 1D7F2B25A76 for ; Mon, 26 Feb 2024 18:24:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5312D12F384; Mon, 26 Feb 2024 18:24:06 +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 C559412EBF6 for ; Mon, 26 Feb 2024 18:24:03 +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=1708971845; cv=none; b=tJToVHzAUmNSwTMhDFvbggaMO1e6Dr9ypw/w58KOKJ4F0E98VQnE9+wxOcXbM9+UG7w/x/y2Wn2jbxZxjvpCRHy5FHoxXXirqi/q8xexWpAYyaZbHymcgLtanM8n02ZhbVDzebPQ9QYqUIsiiKSEyfMw3zbZysyvc3FpWiHVci4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708971845; c=relaxed/simple; bh=EVA7p+p/jssTufLGPq3W6nEZjpm7PKdjlJhX2FVWTAg=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=HARhO7fuw7oDngRfJCjlOP+hUbVcFb18bp/Se29koZMjydntNifYlapJK5ca8kGHSgcMYb8olUKTPSHO9GDDd0kvOdyyuNlHj04Zs8Xb8cjeAXsF24y4KkZHzv316W1BXbq10K5Vj9loMleawd2NE2QER9kKxtTZTKUSFJVJ4LY= 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 1refdl-0003fF-06; Mon, 26 Feb 2024 18:23:49 +0000 Date: Mon, 26 Feb 2024 18:23:42 +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] mtd: ubi: fix NVMEM over UBI volumes on 32-bit systems Message-ID: <186fa96ae25f7033ff8b6f0f7fcfb1e602f556fc.1708971705.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-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 where appropriate. Fixes: 3ce485803da1 ("mtd: ubi: provide NVMEM layer over UBI volumes") Signed-off-by: Daniel Golle --- 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..5820a170d2512 100644 --- a/drivers/mtd/ubi/nvmem.c +++ b/drivers/mtd/ubi/nvmem.c @@ -23,14 +23,17 @@ 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; + uint32_t bytes_left, offs, to_read; struct ubi_nvmem *unv = priv; struct ubi_volume_desc *desc; + uint64_t lnum = from; + int err = 0; desc = ubi_open_volume(unv->ubi_num, unv->vol_id, UBI_READONLY); if (IS_ERR(desc)) return PTR_ERR(desc); + bytes_left = bytes; offs = do_div(lnum, unv->usable_leb_size); while (bytes_left) { to_read = unv->usable_leb_size - offs; -- 2.44.0