From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 90A963BB9F2 for ; Tue, 20 Jan 2026 10:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768903416; cv=none; b=dIWAzDm+oK66ZDmNgDl8jvnlY3pq+Io8ZaJ1De4Kdc3fyHwopK+4gj65+J9H2lJMXqcAWcwhMmoipn89AcOkUupEq/e/wRufje+Iq07WFs7/nqN0rQ38r9XBcxj45NOAaEQG3CCt/xUCL8KWoVfcrORdjyibz+2sqB9CATRbwBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768903416; c=relaxed/simple; bh=LF3DNRDW6IFcgixs68yPGT8hTGxazztwO2nF6eNgzUk=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=P8oUCBPaj3meIZ8L1VGD98Y7m/BKa3Emf5ce+TWtORooXJ1cKbh9udNgsjJ7Ehu9NGd5UMlYODQwQysTxt2mn7sdjFdRpX7UWzFozgOEUMOTwLjSRmLAc+4WLekfFy71GS6XD1UwQXfrMo/L/xIkEHboKVQO7tKIt5unPns5lGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=TLaQa/4o; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="TLaQa/4o" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-b8707005183so882098066b.0 for ; Tue, 20 Jan 2026 02:03:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1768903413; x=1769508213; darn=vger.kernel.org; h=mime-version:user-agent:organization:references:in-reply-to:date:cc :to:from:subject:message-id:from:to:cc:subject:date:message-id :reply-to; bh=LF3DNRDW6IFcgixs68yPGT8hTGxazztwO2nF6eNgzUk=; b=TLaQa/4ow7rESkMzeQ7EXJrxPvRFEk8oMNpOo9gZ6voUeyQn0swiOiq6YYST4zdouZ G/e/zGdKzXCPA//YtZvjmdW5qLVVxrUS5Cl+zcjpuf5c5X/QGD5SvArGX4L5vXD515uK zcK/YLlJPS8xf8uwxXqvcnHpcKyAqLhIx+ai//Z2Rt4/ZEKW3KzsWy0YG/KflCN8vX00 Cp0wexCPaFW07fLO+2F/m9COReWDc8ce1iDLPuadW5GDw8pYHkDXuRTQ1r23HgloyNZu KvbOTNzRReDQce1B4LJ8nUs2qYQsYoiPYkW9zAjwax8vGD1DeZM6z9OVBZioGET0EB0Y T1Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768903413; x=1769508213; h=mime-version:user-agent:organization:references:in-reply-to:date:cc :to:from:subject:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LF3DNRDW6IFcgixs68yPGT8hTGxazztwO2nF6eNgzUk=; b=Y0hrqgq7Mh4xitwC8r9SLHpCwPeOH0d9yzPL2IwuKSL2RI5NGiKXQZStjBA+Hwz5S7 xgrU/QWbyqLKsRyNiE74l/2+/aPGG3d4VBm1fO5yPbWXe35YssOcrfgou8B6lj/rYUHm 7ph8YqWm9tAZdc0mlpQt07HZSX6E/WKYn++4JCIl/BjHEvkW4iPyx+0UtDWMQZmwAur8 OF/xEV8uXlE2T9nCtd8mRt2DXkCPGGf6iZiW31ocSti34HOWKQclhmS39zGzAdjLaeVB ZsK5gDn8qnUEtjxGs/k6X4bseomhrQUr4oCTVqFA2QWXwdhCfUdzK1ZdAL/9UMmSEkLk fOWQ== X-Forwarded-Encrypted: i=1; AJvYcCWMKxj0iE56kRc2Y8gzvF8WsxO5g8vfwQpw7r5rbhstKUBvEw6ILmBOtpTZB9kOc+rlQwNmhFRZFDGASD4=@vger.kernel.org X-Gm-Message-State: AOJu0YwMyyS+K46HtrRX23H6XyQ7fSSvueNgRuQcM7QsEsqHuabA/cqr J3juKCNDFBz/Dp9zR7JbZspHviMvXq23JEwg4esZCBIHKAJCRJofIkXbe3LnZGM5YRs= X-Gm-Gg: AZuq6aLKJb/fIV6eUbhU/8vw7LFKzUwttU371Z5vO3txih/Ba9KVPnRiHPSHC2CEWye T5hqvTBUBCJHmcOfJFLIHCfOY5s6wd2sy4NYAEebgZe4G8DrgLl99JYqlcov+CkQZkdubV7y4qw uAYCTI564RIZeMh5LlMZheSYfLktf/5tfKv1yvTWqiCrYfwbBHsK36Ah+3NltIDld/vGpk1Jnwg kOwwEqln+Dzt4nQgGnKnqagACq1nAFLXcjHpcCXUK/Z6dpZoKi/qnVPWXgfJGu+T+hmb7ZbPKRK x/nc8ZC7JUA+XbO4BlrjPjrj66jV0NsOTDdlV+iNmV0DZqHsHeKNy80lx5RiUYoc9Bsn5HiO1YY Sd/W90PnCe/eHZJvL2AyHUOHwSlOvjbq1pVjFCOHeNBOXfDpverKP3paSp7ksBoctFQM/WIk8+D iKSecg X-Received: by 2002:a17:907:1c88:b0:b87:2bd6:6bb6 with SMTP id a640c23a62f3a-b87932eb1a0mr1022315666b.64.1768903412662; Tue, 20 Jan 2026 02:03:32 -0800 (PST) Received: from [10.203.83.229] ([151.47.45.157]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8795292783sm1344879166b.31.2026.01.20.02.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 02:03:32 -0800 (PST) Message-ID: <9149f9c75c9f961da29829577ba4476681f4e82c.camel@baylibre.com> Subject: Re: [PATCH v3 3/3] iio: imu: st_lsm6dsx: add support for rotation sensor From: Francesco Lavra To: Andy Shevchenko Cc: Lorenzo Bianconi , Jonathan Cameron , David Lechner , Nuno =?ISO-8859-1?Q?S=E1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 20 Jan 2026 11:03:26 +0100 In-Reply-To: References: <20260119100449.1559624-1-flavra@baylibre.com> <20260119100449.1559624-4-flavra@baylibre.com> <851180c6f41f8c9cc79d6412eb97f381f0312f00.camel@baylibre.com> Organization: BayLibre Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-b7hIN649gMk+JAo5hWxf" User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --=-b7hIN649gMk+JAo5hWxf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2026-01-20 at 11:36 +0200, Andy Shevchenko wrote: > On Tue, Jan 20, 2026 at 10:28:15AM +0100, Francesco Lavra wrote: > > On Mon, 2026-01-19 at 12:33 +0200, Andy Shevchenko wrote: > > > On Mon, Jan 19, 2026 at 11:04:49AM +0100, Francesco Lavra wrote: >=20 > ... >=20 > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0snprintf(sensor->name, s= izeof(sensor->name), "%s_sf", > > > > name); > > >=20 > > > Does GCC complain on this (`make W=3D1` build)? > > > Since this can cut the string and we don't check the return value, > > > the Q > > > is: > > > is this okay to have a reduced string? > >=20 > > gcc does not complain with W=3D1. sensor->name is appropriately sized t= o > > accommodate the longest possible name; if it wasn't, the string would > > be > > cut in the accel and gyro IIO devices too (which use a longer suffix > > than > > "_sf"). >=20 > Right, the question is if compiler can prove that or not. >=20 > We have several patches in input subsystem to hide the warning by > switching > to scnprintf(), which I consider not the best approach, but still it > depends > if we care about cut or not. If we do, we should check for overflow. A truncated string would result in a corrupted value in /sys/bus/iio/devices/iio:deviceX/name, so I would say we do care if it's truncated. But I think the most appropriate check we could add in the code is a BUG_ON(); would that be acceptable? --=-b7hIN649gMk+JAo5hWxf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEhleFT5U73KMewxTm7fE7c86UNl8FAmlvUu4ACgkQ7fE7c86U Nl80Kgv/aDA+Jv76EZ8AH78iGzWSbZxxCHIBzfOoJFVYnR4rrVtoirEWhPivFKOF pLy82UwhUXbiCPlFI8Zyr8uz/789ur2lL6/wwv/lsctxfU5BqJQyIxLaJHj0+a+X WAOS/AYHg53yg90vFWCYJwb07May8Y/Us+0VYCN3DchtM+5gaaU6yw+LiKEC6fku pMHCGeS49NRMiLn/gu3zzqpaH66G38yFc4S/P3U63SlVY7FEoGLqA8ul73G9RTp6 /Ps90HhsJJNsFCbcoxQTNv3Ubmpm4hT3wv5s+SFt9Id0dPTKYSx6xJHXy1+FrEjW RUXm4tPjYrp6wDA2a1ldgeXrApEh+1PkoDUOieW/mKBUcEv94941Z6CUd2qAZTGg Xljmwo7L4ArxFibk1JOe0HwnLQfWdJ+GQG12bEAy2k07ChWYuPuo3nWsrqJSVkSR AAs91p9J92jWC9AbTLYA50Nwo7d04xEBo2Qwb/ZWIuuw45EiHnXrVGeFexEDWrrJ CiZ9GKe5 =javF -----END PGP SIGNATURE----- --=-b7hIN649gMk+JAo5hWxf--