| Message ID | 20260715175229.24672-6-linkmauve@linkmauve.fr (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-24447-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id 1E3051C2FCD for <noreply@patchwork.local>; Wed, 15 Jul 2026 19:57:06 +0200 (CEST) Authentication-Results: mxe881; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-24447-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-24447-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id EC78C302ED54 for <noreply@patchwork.local>; Wed, 15 Jul 2026 17:53:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C21FB4A33F6; Wed, 15 Jul 2026 17:53:17 +0000 (UTC) X-Original-To: linux-sunxi@lists.linux.dev Received: from luna.linkmauve.fr (82-65-109-163.subs.proxad.net [82.65.109.163]) (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 6A6414A2E01; Wed, 15 Jul 2026 17:53:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.65.109.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784137997; cv=none; b=UKQvnDfC+buSzI/W/tFk4tgvqWiRVJtlp1fD6dANqLxq9U5O0GPjlYeSMI3v+jPu/Nb3U6zJ/GIzj6FqpwDbMagz9vKmLEM2unMVYTAvBg7BTnhpOBzl8w+aGpiaX9rK52YzS6qJe0HCmv4AKcftoqZgtaOs+NEjZeCsOgu0YMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784137997; c=relaxed/simple; bh=e2X4aAIB35tnuNFFrR/sMDVNB8hl9ij7Uv+uzc+FvF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fA2aG7PWmpsxBo0Z0pCL1sgHkTV5HkP35M/jgP5odoDctuhm1P8FUw8njITi3VlrefYb5MwRcIprQveUtCCHuYoa9WR5FGyE/JvNoR1hpF9CZGLw3Vni+XxD3mjAAq4umYY4V+IHjmYnwKjmk6hWfqo0fdp753JjXkpfe79zvPg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linkmauve.fr; spf=pass smtp.mailfrom=linkmauve.fr; arc=none smtp.client-ip=82.65.109.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linkmauve.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linkmauve.fr Received: by luna.linkmauve.fr (Postfix, from userid 1000) id D52EEF40D22; Wed, 15 Jul 2026 19:52:45 +0200 (CEST) From: Link Mauve <linkmauve@linkmauve.fr> To: Srinivas Kandagatla <srini@kernel.org> Cc: Link Mauve <linkmauve@linkmauve.fr>, Neil Armstrong <neil.armstrong@linaro.org>, Kevin Hilman <khilman@baylibre.com>, Jerome Brunet <jbrunet@baylibre.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com>, Jonathan Cameron <jic23@kernel.org>, David Lechner <dlechner@baylibre.com>, =?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@analog.com>, Andy Shevchenko <andy@kernel.org>, Sakari Ailus <sakari.ailus@linux.intel.com>, Tianshu Qiu <tian.shu.qiu@intel.com>, Bingbu Cao <bingbu.cao@intel.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, Aaro Koskinen <aaro.koskinen@iki.fi>, Andreas Kemnade <andreas@kemnade.info>, Roger Quadros <rogerq@kernel.org>, Tony Lindgren <tony@atomide.com>, Lee Jones <lee@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Bartosz Golaszewski <brgl@kernel.org>, "Vaibhaav Ram T.L" <vaibhaavram.tl@microchip.com>, Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>, Frank Li <Frank.Li@nxp.com>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, Vladimir Zapolskiy <vz@mleia.com>, =?utf-8?q?Andr=C3=A9_Draszik?= <andre.draszik@linaro.org>, Orson Zhai <orsonzhai@gmail.com>, Baolin Wang <baolin.wang@linux.alibaba.com>, Chunyan Zhang <zhang.lyra@gmail.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Praveen Teja Kundanala <praveen.teja.kundanala@amd.com>, Kalyani Akula <kalyani.akula@amd.com>, Michal Simek <michal.simek@amd.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Joshua Kinard <linux@kumba.dev>, Antoniu Miclaus <antoniu.miclaus@analog.com>, Chen-Yu Tsai <wens@kernel.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>, Miguel Ojeda <ojeda@kernel.org>, Boqun Feng <boqun@kernel.org>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj?= =?utf-8?q?=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Benno Lossin <lossin@kernel.org>, Andreas Hindborg <a.hindborg@kernel.org>, Alice Ryhl <aliceryhl@google.com>, Trevor Gross <tmgross@umich.edu>, Danilo Krummrich <dakr@kernel.org>, Daniel Almeida <daniel.almeida@collabora.com>, Tamir Duberstein <tamird@kernel.org>, Alexandre Courbot <acourbot@nvidia.com>, =?utf-8?q?Onur_=C3=96zkan?= <work@onurozkan.dev>, Daniel Lezcano <daniel.lezcano@kernel.org>, Johan Hovold <johan@kernel.org>, Ronald Claveau <linux-kernel-dev@aliel.fr>, Salah Triki <salah.triki@gmail.com>, Yury Norov <ynorov@nvidia.com>, David Carlier <devnexen@gmail.com>, Achim Gratz <Achim.Gratz@Stromeko.DE>, Alexander Sverdlin <alexander.sverdlin@siemens.com>, Patrick Wicki <patrick.wicki@siemens.com>, Markus Heidelberg <m.heidelberg@cab.de>, Markus Perkins <markus@notsyncing.net>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=28?= =?utf-8?q?The_Capable_Hub=29?= <u.kleine-koenig@baylibre.com>, Bjorn Helgaas <bhelgaas@google.com>, Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>, Chen Ni <nichen@iscas.ac.cn>, Kees Cook <kees@kernel.org>, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, linux-media@vger.kernel.org, linux-omap@vger.kernel.org, mfd@lists.linux.dev, linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org, imx@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-rtc@vger.kernel.org, linux-sunxi@lists.linux.dev, rust-for-linux@vger.kernel.org Subject: [PATCH 5/8] iio: pressure: bmp280: make reg_write callback take const void * Date: Wed, 15 Jul 2026 19:52:21 +0200 Message-ID: <20260715175229.24672-6-linkmauve@linkmauve.fr> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260715175229.24672-1-linkmauve@linkmauve.fr> References: <20260715175229.24672-1-linkmauve@linkmauve.fr> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [4.34 / 15.00]; RBL_SENDERSCORE(2.00)[172.234.253.10:from]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TAGGED_RCPT(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[linkmauve.fr:email,sea.lore.kernel.org:rdns,sea.lore.kernel.org:helo]; PRECEDENCE_BULK(0.00)[]; DMARC_DNSFAIL(0.00)[linkmauve.fr : server fail]; FREEMAIL_CC(0.00)[linkmauve.fr,linaro.org,baylibre.com,googlemail.com,kernel.org,analog.com,linux.intel.com,intel.com,iki.fi,kemnade.info,atomide.com,arndb.de,linuxfoundation.org,microchip.com,nxp.com,pengutronix.de,gmail.com,mleia.com,linux.alibaba.com,foss.st.com,amd.com,bootlin.com,kumba.dev,sholland.org,garyguo.net,protonmail.com,google.com,umich.edu,collabora.com,nvidia.com,onurozkan.dev,aliel.fr,Stromeko.DE,siemens.com,cab.de,notsyncing.net,iscas.ac.cn,lists.infradead.org,vger.kernel.org,lists.linux.dev,st-md-mailman.stormreply.com]; FORGED_SENDER_MAILLIST(0.00)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1]; RCVD_COUNT_FIVE(0.00)[5]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_GT_50(0.00)[88]; R_SPF_ALLOW(0.00)[+ip4:172.234.253.10:c]; FROM_HAS_DN(0.00)[]; R_DKIM_NA(0.00)[]; TAGGED_FROM(0.00)[bounces-24447-noreply=patchwork.local]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[linkmauve@linkmauve.fr,linux-sunxi@lists.linux.dev]; ASN(0.00)[asn:63949, ipnet:172.234.224.0/19, country:SG]; TO_DN_SOME(0.00)[] X-Rspamd-Queue-Id: 1E3051C2FCD X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= |
| Series |
nvmem: make reg_write() take a const void *
|
|
Commit Message
Link Mauve
July 15, 2026, 5:52 p.m. UTC
The previous commit switched from a pointer to mutable data to a pointer
to immutable data, so let’s fix all users of the nvmem_config API.
Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
---
drivers/iio/pressure/bmp280-core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: New issues: - [Low] Syntax error due to 'void void *_val' parameter in qfprom_reg_write. Pre-existing issues: - [Critical] m48t59_nvram_read and m48t59_nvram_write completely ignore the requested offset. -- --- Patch [5]: [PATCH 5/8] iio: pressure: bmp280: make reg_write callback take const void * --- commit bd8404c8c6d692d9a700578455111f78fd0eaf2a Author: Link Mauve <linkmauve@linkmauve.fr> iio: pressure: bmp280: make reg_write callback take const void * The previous commit switched from a pointer to mutable data to a pointer to immutable data, so let’s fix all users of the nvmem_config API. > diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c > index a872c640b8c5a..bacdcb5610bae 100644 > --- a/drivers/nvmem/qfprom.c > +++ b/drivers/nvmem/qfprom.c > @@ -253,13 +253,13 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv, > * > * Return: 0 or -err. > */ > -static int qfprom_reg_write(void *context, unsigned int reg, void *_val, > +static int qfprom_reg_write(void *context, unsigned int reg, void void *_val, > size_t bytes) > { [Severity: Low] Does this syntax error in qfprom_reg_write() prevent the qfprom driver from compiling? It looks like "void void *_val" was introduced during a find-and-replace to make the callback take a const void pointer. > struct qfprom_priv *priv = context; > struct qfprom_touched_values old; > int words = bytes / 4; > - u32 *value = _val; > + const u32 *value = _val; > u32 blow_status; [ ... ] > diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c > index 4e608bc8bbd36..ad407faecf1f8 100644 > --- a/drivers/rtc/rtc-m48t59.c > +++ b/drivers/rtc/rtc-m48t59.c > @@ -325,7 +325,7 @@ static int m48t59_nvram_write(void *priv, unsigned int offset, void *val, > struct m48t59_private *m48t59 = platform_get_drvdata(pdev); > ssize_t cnt = 0; > unsigned long flags; > - u8 *buf = val; > + const u8 *buf = val; > > spin_lock_irqsave(&m48t59->lock, flags); > [Severity: Critical] This is a pre-existing issue, but does the loop in m48t59_nvram_write() completely ignore the requested offset? It appears that cnt starts at 0 and is used as the hardware address instead of adding the requested offset: drivers/rtc/rtc-m48t59.c:m48t59_nvram_write() { ... for (; cnt < size; cnt++) M48T59_WRITE(*buf++, cnt); ... } Any subsystem or user-space application performing an NVMEM write at an offset greater than 0 will silently overwrite data at the very beginning of the NVRAM. The same issue seems to be present in m48t59_nvram_read(), which could lead to incorrect data disclosure: drivers/rtc/rtc-m48t59.c:m48t59_nvram_read() { ... for (; cnt < size; cnt++) *buf++ = M48T59_READ(cnt); ... }
diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c index 990340a9b10c..0a39c5f39378 100644 --- a/drivers/iio/pressure/bmp280-core.c +++ b/drivers/iio/pressure/bmp280-core.c @@ -2261,11 +2261,11 @@ static int bmp580_nvmem_read(void *priv, unsigned int offset, void *val, return ret; } -static int bmp580_nvmem_write_impl(void *priv, unsigned int offset, void *val, +static int bmp580_nvmem_write_impl(void *priv, unsigned int offset, const void *val, size_t bytes) { struct bmp280_data *data = priv; - u16 *buf = val; + const u16 *buf = val; int ret, addr; guard(mutex)(&data->lock); @@ -2322,7 +2322,7 @@ static int bmp580_nvmem_write_impl(void *priv, unsigned int offset, void *val, return ret; } -static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val, +static int bmp580_nvmem_write(void *priv, unsigned int offset, const void *val, size_t bytes) { struct bmp280_data *data = priv;