Message ID | 20240104101253.25896-1-petre.rodan@subdimension.ro |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-16491-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5519237dyb; Thu, 4 Jan 2024 02:13:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGpkX/9UN+bp3X3Z0jZO1S3VsnPgJ2UcnFiMBaVII5nGdRELat/LrDzhqlwR35BBr7sQ6Q X-Received: by 2002:a50:c2d1:0:b0:556:e007:dcc2 with SMTP id u17-20020a50c2d1000000b00556e007dcc2mr254094edf.27.1704363227856; Thu, 04 Jan 2024 02:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704363227; cv=none; d=google.com; s=arc-20160816; b=YcL1/o810OiYDBgybJqk5zJEjDRbfSOCyKIwxvtsmuJz2foUnOHTkBLEpDcZIT48de ZjFZYc+BwufdEgDsDW3FR0fPGx2i5BpasA3KnzvWmYBj1n6q1AOqBOakz+TrdbVoZxP+ B4UArrGhN1x7Pw4QTuCVeWxXHAqeemqhf3gKWMQyLhMpfPqu6+ul1slnLs2az3xc7Bh2 eRrIfrAZSRptl2RgPd9C7FGT5invCveWfK+NgFzJjJ/kfwGdpi824GzWut/YvOlSig6F 59+YPNpG1bDv5Jk5gMu/UVstsU/ezdJpPvP+gNn/bkKrZ0dhwraElE2M7iQrhe/Wnn5X pOxQ== 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=eU6kQ5/oOYXZSZfBlaS3ZW4rC8xgKAB2NSh5JIwTFig=; fh=RpJjGiuDlOjmyoLhPwSzjbPbeK51vYo3I0V3BuRLNmU=; b=juv16TaQBlaF8JLoQ/2wEg1P8j+jUhZFJE7PXvoZ++iRtbJ4MbjydL+mY+tsGN5Qhi rdLzwzhHP8hmXPGoOA+eD0/HzCQusoZadq7u2sVSxrOZVrxzsEs1BVa1Y57p0yRNZv2w dRij3hPRV1AO4SYQ/4v6cZODzHs8DvAgBwpxTzfV3yKFg89CZA0sxzQMUemyDF0yPYxV GpgjB9JyHNz5QJM1GJ5NBo5FlPw5L7JKurb+/0FwGL38dR66yEJbBvoZRwJa/4KFQ3Ub pzC3Iq+XOW8X5QJ82wQTfdNsomzE4t7laLfmzdXuWC0fd7aHpSLtAU+x4tohHCZCc6DF j92w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=hWfltW6+; spf=pass (google.com: domain of linux-kernel+bounces-16491-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16491-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 b9-20020a056402278900b00553a50492e4si12825123ede.388.2024.01.04.02.13.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 02:13:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16491-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=hWfltW6+; spf=pass (google.com: domain of linux-kernel+bounces-16491-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16491-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 730AF1F25048 for <ouuuleilei@gmail.com>; Thu, 4 Jan 2024 10:13:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8AE0620DCF; Thu, 4 Jan 2024 10:13:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="hWfltW6+" 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 BC71020B02; Thu, 4 Jan 2024 10:13:16 +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 9758F28B53B; Thu, 4 Jan 2024 10:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1704363188; bh=j+qznhwVfcrCXO97E0Jld5V71MZIo0m6mSOS1YPgQZY=; h=From:To:Cc:Subject:Date; b=hWfltW6+nBoLPlzOFWVPtgMG0gPu8GhbhV1vBgU8mzf+hQqhE3xn8SRdPIp31I3DJ cwYoV39J6/fLpULvNP2QJQ2qSRj4M63xCjm0gOaGRaAf0AkvOGfbElQIOd8ldQ8KaA oYkTuVvB46Fqvh8u+OxKh1od7uUKl2X+/07M9CJs= 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 0/1] tools: iio: fix iio_generic_buffer Date: Thu, 4 Jan 2024 12:12:44 +0200 Message-ID: <20240104101253.25896-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: 1787154376109837535 X-GMAIL-MSGID: 1787154376109837535 |
Series |
tools: iio: fix iio_generic_buffer
|
|
Message
Petre Rodan
Jan. 4, 2024, 10:12 a.m. UTC
While executing tools/iio_generic_buffer i was getting this fault:
beagle /usr/src/linux/tools/iio # ./iio_generic_buffer -a -c 10 -N 0 -T 0
iio device number being used is 0
iio trigger number being used is 0
Auto-channels selected but some channels are already activated in sysfs
Proceeding without activating any channels
/sys/bus/iio/devices/iio:device0 mytmr
Floating point exception
The FPE was generated due to a modulo zero in size_from_channelarray()
(all channels[].bytes were zero because channels[] were never populated).
The root of the cause is the seekdir() function within
build_channel_array().
On my system I can observe a clear difference between these two functions:
seekdir(dp, 0);
printf("location = %lu\n", telldir(dp)); // location == 4294967295
rewinddir(dp);
printf("location = %lu\n", telldir(dp)); // location == 1
The attached patch fixed the bug for me.
I'm using a BeagleBone Black devboard with an up-to-date stable branch
Gentoo Linux OS on top of it.
CHOST: armv7a-unknown-linux-gnueabihf
kernel: mainline 6.7.0-rc6
glibc: 2.37-r7:2.2::gentoo USE="caps gd multiarch ssp static-libs -audit
-cet -compile-locales -crypt -custom-cflags -doc -hash-sysv-compat
-headers-only -multilib -multilib-bootstrap -nscd -perl -profile
(-selinux) -stack-realign -suid -systemd -systemtap -test -vanilla"
(+ contains Gentoo specific patches)
Fixes: <e58537ccce733> ("staging: iio: update example application.")
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Petre Rodan (1):
tools: iio: fix iio_generic_buffer
tools/iio/iio_utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.41.0