Message ID | 20240108103224.3986-1-petre.rodan@subdimension.ro |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-19337-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp934873dyq; Mon, 8 Jan 2024 02:32:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4Xx9Mxik04zqgelGUs8gsmrJaV7TDVapB/2g92URmVCSemEc5qNe3D5jofq/8igOCOOLL X-Received: by 2002:a05:6512:466:b0:50e:8107:1def with SMTP id x6-20020a056512046600b0050e81071defmr1142924lfd.122.1704709973797; Mon, 08 Jan 2024 02:32:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704709973; cv=none; d=google.com; s=arc-20160816; b=BMe1Q0ZF/nXiEUBREjSUsZwAiZzRE85g/47nSbmNk+GIWQhJkCeJy48H0J3M7awpZL 69W5bWxMnEiPnhFrOBFVDm73eCjei56cs9huSYicgqKkrDHRANNFnBdx7fFeoU+UBcyy DgEKXmWfTMKJZuIOoqzD0iOtDnDzllcHiFko/AFS2E2clfW6faLyYMkemw40nFA2Vsex j572GKGyewimgIQ55VvGBvCPZuI3qcTRM+83jckys5tF7j59OXIJMKaLnCvMtdxsh8ZO fip/qF/k1ref388h8zQlEySg5EZ6PrUUNef0PCXNOccsftxRVaDKIcn4Iw5VHd1yM9mh usUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=qIGWZGnmCFnhkcZu+BwszJmef78evoLShAO4XaebCYo=; fh=RpJjGiuDlOjmyoLhPwSzjbPbeK51vYo3I0V3BuRLNmU=; b=IVOYd1hOm1PZq0Ju4DFQN0oTt4XGpJZUAXmKtJOj86gFxE76tpE6vMMkm21EZxcHzx KMjTwDKMsGBmxzrHVj7yQ/MGCufuMe0c/mrwfy61KoO9oefVoVupMIyA/O83Qwua1jHv ChzVQpSlrDawBuufJrWTF7SZU0rdxp6ts7GU4qrgo5fr+BS2wW+u7Xy1+fQ89lmfwpby jcxw9LH5aiQ/eTfzPz+o0jExBK05Ua+WSLW0xea3cElgiguoTnU10fRNBaMajnefeTbN zw5qMj6sJUFJ5tHLb1jvYGXR8bLCLMbQmc8EgeRo50dawbcDVffyNoQgvfnkWZLxTT/K CKfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=rKinlehF; spf=pass (google.com: domain of linux-kernel+bounces-19337-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19337-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o8-20020a509b08000000b00557742ca986si1764418edi.39.2024.01.08.02.32.53 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 02:32:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19337-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=rKinlehF; spf=pass (google.com: domain of linux-kernel+bounces-19337-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19337-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 59F941F2237C for <ouuuleilei@gmail.com>; Mon, 8 Jan 2024 10:32:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 905ED13FFB; Mon, 8 Jan 2024 10:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="rKinlehF" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.subdimension.ro (skycaves.subdimension.ro [172.104.132.142]) (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 E1F9F13FF0; Mon, 8 Jan 2024 10:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=subdimension.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=subdimension.ro Received: from localhost.localdomain (unknown [188.24.94.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.subdimension.ro (Postfix) with ESMTPSA id C7DFA28B53B; Mon, 8 Jan 2024 10:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1704709953; bh=xXbmxn5INj/J1TQWPOKYjsTvyEdW1MHuOlWjpU57nV0=; h=From:To:Cc:Subject:Date; b=rKinlehFkpTpkSle87AdgEryyN6wAzMEKKKAOmNJ0meHRa6NtWfGxYb9XXZAnd6KE ArlCYP6UVFSGU+P1TnEFvxOUXBh5jJm/wt3RQeKCIzNkRmnXT1vjeHOZx4ufY9zwn1 7P5omYDwfOD9KqE+HJ5AQ1h5D9lU1AEOPfuQC9iA= From: Petre Rodan <petre.rodan@subdimension.ro> To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan <petre.rodan@subdimension.ro>, Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de> Subject: [PATCH 1/1] tools: iio: replace seekdir() in iio_generic_buffer Date: Mon, 8 Jan 2024 12:32:20 +0200 Message-ID: <20240108103224.3986-1-petre.rodan@subdimension.ro> X-Mailer: git-send-email 2.41.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787517965258187059 X-GMAIL-MSGID: 1787517965258187059 |
Series |
[1/1] tools: iio: replace seekdir() in iio_generic_buffer
|
|
Commit Message
Petre Rodan
Jan. 8, 2024, 10:32 a.m. UTC
Replace seekdir() with rewinddir() in order to fix a localized glibc bug.
One of the glibc patches that stable Gentoo is using causes an improper
directory stream positioning bug on 32bit arm. That in turn ends up as a
floating point exception in iio_generic_buffer.
The attached patch provides a fix by using an equivalent function which
should not cause trouble for other distros.
https://sourceware.org/bugzilla/show_bug.cgi?id=31212
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
---
tools/iio/iio_utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.41.0
Comments
On Mon, 8 Jan 2024 12:32:20 +0200 Petre Rodan <petre.rodan@subdimension.ro> wrote: > Replace seekdir() with rewinddir() in order to fix a localized glibc bug. > > One of the glibc patches that stable Gentoo is using causes an improper > directory stream positioning bug on 32bit arm. That in turn ends up as a > floating point exception in iio_generic_buffer. > > The attached patch provides a fix by using an equivalent function which > should not cause trouble for other distros. > > https://sourceware.org/bugzilla/show_bug.cgi?id=31212 > > Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro> I tweaked the description a tiny bit to say it's also easier to reason about in general. Applied to the togreg branch of iio.git and pushed out as tesing for 0-day to probably ignore it. Thanks, Jonathan > --- > tools/iio/iio_utils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c > index 6a00a6eecaef..c5c5082cb24e 100644 > --- a/tools/iio/iio_utils.c > +++ b/tools/iio/iio_utils.c > @@ -376,7 +376,7 @@ int build_channel_array(const char *device_dir, int buffer_idx, > goto error_close_dir; > } > > - seekdir(dp, 0); > + rewinddir(dp); > while (ent = readdir(dp), ent) { > if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), > "_en") == 0) { > -- > 2.41.0 >
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index 6a00a6eecaef..c5c5082cb24e 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -376,7 +376,7 @@ int build_channel_array(const char *device_dir, int buffer_idx, goto error_close_dir; } - seekdir(dp, 0); + rewinddir(dp); while (ent = readdir(dp), ent) { if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), "_en") == 0) {