Message ID | 20240104101253.25896-2-petre.rodan@subdimension.ro |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-16492-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5519280dyb; Thu, 4 Jan 2024 02:13:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+Paq9vcXSzix6xlkiXl4JUcwCzjilvY+uj2VUxszkyp+0lAXTfpCshOjASEErgwii4BF/ X-Received: by 2002:a17:906:db06:b0:a27:fc45:f4a0 with SMTP id xj6-20020a170906db0600b00a27fc45f4a0mr186209ejb.134.1704363232010; Thu, 04 Jan 2024 02:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704363231; cv=none; d=google.com; s=arc-20160816; b=TfY+nmDS/1A1QCBMzlui5K3SnYB5Qn45zogAqWvTrtEqgUdpLYbd38TgsZ8yMQLIrq dQH4R2Qr3YbrMMvvcjLKQ7HA7gR53VCCP8s9BPgy9JfWrP+h3NynPYxYJng0NAV41p2d U+ZAM41qMhpGfO9kdgfjAO7CSLn90x3czLHCzPuKdUZ0Uw6VM+pFH+5rHNZqVF5j/fW4 nO6DxMoxngg67an2J20oC27r54rLv6WTuGlD9Z7jVU2r60319LybiprfAcbM4XlvNa/Q ysdDgktYgdCTlXbLRgnkJ/Cahgqb/7i3qq29RsBa0LBYBOalr6rcPnfCEzlTMLxRaZkk E1Ng== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NUHTtxr+RG5yD/mfWQVtNYSD/peUE8LkCAmXI884j3E=; fh=RpJjGiuDlOjmyoLhPwSzjbPbeK51vYo3I0V3BuRLNmU=; b=pzH6WF3a1xJD1LxEC6AbSeyshjXmTa52LQmrk5u1Uqfrql+5Vh5EzsBDRyJAkzvOv4 6H1Nh6FgihrgB/YSj6o79sef5iymAedRe+rEXUifU44ouIRcsQhazQi6jMs94KrX8X3O 6EgSDbrDMofh/r6v4NVGoNx0FhCVKPfI36zGpP72h/rxF368SleRkO7szFCMLCoc4TbX zr8X9Q7XyPP3x0QhemNpL+6dZL/4x9piTA050zTYXLLy4ZOO8IiNfHD6g0O5JmHEwu7/ jr5DVqO0NC8ERfqP86sflfpk9Pjd1ZBogJO0rqmz1tKdVkdCUI/JzLkLiInioptGO6Uz h2+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=RIE4hYZm; spf=pass (google.com: domain of linux-kernel+bounces-16492-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16492-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id vp16-20020a17090712d000b00a28f25ea427si53455ejb.1011.2024.01.04.02.13.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 02:13:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16492-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=RIE4hYZm; spf=pass (google.com: domain of linux-kernel+bounces-16492-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16492-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro 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 9E4F41F251B4 for <ouuuleilei@gmail.com>; Thu, 4 Jan 2024 10:13:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0498E20DDA; Thu, 4 Jan 2024 10:13:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="RIE4hYZm" 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 D985820B05; Thu, 4 Jan 2024 10:13:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (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 04E1128B588; Thu, 4 Jan 2024 10:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1704363196; bh=kEXpL8WMuP3th/Z3LBH600YSxDVmVFaqD9RHewchWrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RIE4hYZmlXUQ3Z9eUdL8chkU0M8ln9g+MpCOoS3kwHU+v2YQdVuxrowE9flnYRPDN ZJVSpzEz1tbVDO9UGiig9NuWxbg0RdROjWBRxihFw6uq3FaNKwhabYiTs6/cte2tRO 8XfAbzc1EsX7/vnFMBYlxqdrbl19SMzdS4bgqtj8= 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: fix iio_generic_buffer Date: Thu, 4 Jan 2024 12:12:45 +0200 Message-ID: <20240104101253.25896-2-petre.rodan@subdimension.ro> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240104101253.25896-1-petre.rodan@subdimension.ro> References: <20240104101253.25896-1-petre.rodan@subdimension.ro> 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: 1787154376109837535 X-GMAIL-MSGID: 1787154380173502130 |
Series |
tools: iio: fix iio_generic_buffer
|
|
Commit Message
Petre Rodan
Jan. 4, 2024, 10:12 a.m. UTC
Fix code flow problem and floating point exception caused by improper
directory stream positioning.
Fixes: <e58537ccce733> ("staging: iio: update example application.")
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 Thu, 4 Jan 2024 12:12:45 +0200 Petre Rodan <petre.rodan@subdimension.ro> wrote: > Fix code flow problem and floating point exception caused by improper > directory stream positioning. > > Fixes: <e58537ccce733> ("staging: iio: update example application.") > Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro> Hi Petre, This doesn't really explain 'why' seeekdir(dp, 0) is wrong. My assumption is that telldir() would not have returned 0 on this particular system? Could you confirm that and update the message to explain why seekdir(dp, 0) is not equivalent to rewinddir(dp). 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 >
Hi Jonathan, On Sun, Jan 07, 2024 at 03:53:33PM +0000, Jonathan Cameron wrote: > On Thu, 4 Jan 2024 12:12:45 +0200 > Petre Rodan <petre.rodan@subdimension.ro> wrote: > > > Fix code flow problem and floating point exception caused by improper > > directory stream positioning. > > > > Fixes: <e58537ccce733> ("staging: iio: update example application.") > > Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro> > Hi Petre, > > This doesn't really explain 'why' seeekdir(dp, 0) is wrong. > My assumption is that telldir() would not have returned 0 on this particular > system? Could you confirm that and update the message to explain why > seekdir(dp, 0) is not equivalent to rewinddir(dp). it looks like there is a 32-bit specific bug in one of the glibc patches that the stable Gentoo Linux is using [1]. telldir returns (u32)(-1) if seekdir is used which ends up in a floating point exception. it so happens that the rewinddir() function (which is equivalent) works correctly. so it is a fix for Gentoo users and should not impact anyone else. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=31212 my very best regards, peter > 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
On Sun, 7 Jan 2024 18:28:52 +0200 Petre Rodan <petre.rodan@subdimension.ro> wrote: > Hi Jonathan, > > On Sun, Jan 07, 2024 at 03:53:33PM +0000, Jonathan Cameron wrote: > > On Thu, 4 Jan 2024 12:12:45 +0200 > > Petre Rodan <petre.rodan@subdimension.ro> wrote: > > > > > Fix code flow problem and floating point exception caused by improper > > > directory stream positioning. > > > > > > Fixes: <e58537ccce733> ("staging: iio: update example application.") > > > Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro> > > Hi Petre, > > > > This doesn't really explain 'why' seeekdir(dp, 0) is wrong. > > My assumption is that telldir() would not have returned 0 on this particular > > system? Could you confirm that and update the message to explain why > > seekdir(dp, 0) is not equivalent to rewinddir(dp). > > it looks like there is a 32-bit specific bug in one of the glibc patches that > the stable Gentoo Linux is using [1]. telldir returns (u32)(-1) if seekdir is > used which ends up in a floating point exception. > > it so happens that the rewinddir() function (which is equivalent) works > correctly. so it is a fix for Gentoo users and should not impact anyone else. > > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=31212 > > my very best regards, > peter I'd be happy to take the same change as a cleanup if you want to resubmit it with a different patch description. Thanks, Jonathan > > > 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
Hi Jonathan, On Sun, Jan 07, 2024 at 05:00:26PM +0000, Jonathan Cameron wrote: > > On Sun, Jan 07, 2024 at 03:53:33PM +0000, Jonathan Cameron wrote: > > > On Thu, 4 Jan 2024 12:12:45 +0200 > > > Petre Rodan <petre.rodan@subdimension.ro> wrote: > > > > > > > Fix code flow problem and floating point exception caused by improper > > > > directory stream positioning. > > > > > > > > Fixes: <e58537ccce733> ("staging: iio: update example application.") > > > > Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro> > > > Hi Petre, > > > > > > This doesn't really explain 'why' seeekdir(dp, 0) is wrong. > > > My assumption is that telldir() would not have returned 0 on this particular > > > system? Could you confirm that and update the message to explain why > > > seekdir(dp, 0) is not equivalent to rewinddir(dp). > > > > it looks like there is a 32-bit specific bug in one of the glibc patches that > > the stable Gentoo Linux is using [1]. telldir returns (u32)(-1) if seekdir is > > used which ends up in a floating point exception. > > > > it so happens that the rewinddir() function (which is equivalent) works > > correctly. so it is a fix for Gentoo users and should not impact anyone else. > > > > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=31212 > > > > my very best regards, > > peter > > I'd be happy to take the same change as a cleanup if you want to resubmit it > with a different patch description. sure, I will resubmit it, but tomorrow morning. best regards, peter
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) {