From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796339645; b=XC3VxB0F3rirVozKckMZE6z3IHg2YUItkjc29dR1kN2lT8mo78+512uzoDjKiAun6Cis Gt4gFEe3+Ff/nnUlJiuc0Cm9ZokRaMyAHruiPn2GdFLz7bUMuyIHR8cBtArciBhHS9HOa MXA7gM2ITVQ4c5V7JS7rPGQlsCGkafy0U3fTnsMtRkvaLccHHfxfKvYBAggUuwhb2+wwk z38FLEKc/aKObKB7UbxDb4xr0bvw+aUmAg6M8KLib2rxZ29ZOmTWD9X78xuyDTD6KXoh2 MVicC4TRwkHJhhnAXDkpxSsuCHRML7udlRetVgouBER96xfSF5cJoZcWvKpmmRdcuXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796339645; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jJsjjiJEiiFzGWz6XInFb5LIcDQDUG02I/hp+GUzd3c=; b=pgkwaq8sy7YYUABsZVwbroX7xvt3XcBwyTJNAc2uaYhRdZhYqfhw2tIr+8PH3jX3o/48 e32mjc3s+ECnLEkCwKicrY+JFrE7zdyJnhYaO9qLb/ELSRQMzvnqa0pQJWvNfuS35C44f n1JpVmxnAPw+kJNmVTKghc5WJpF/n45i+4gMNaCK4Fam1bUOzcksoybJJwN3MxJ2ihmbQ pglRQjncCpDbp3KBzZY+9N8QIVfw8srZqohjF+TooXd1uZ2D3Ww7nh/FK6dwUeLJpagsH RGq3pqfcu9sVMsHRhkzZVvjVJpVa1GqQmV7RxOC6z0l5EqnmQrbn4CvywyiAlDt5UYw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lkZl69Ky; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8E39606A322 for ; Thu, 3 Dec 2026 23:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lkZl69Ky Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D5B71F000C2; Thu, 3 Dec 2026 23:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796339645; bh=jJsjjiJEiiFzGWz6XInFb5LIcDQDUG02I/hp+GUzd3c=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=lkZl69KycIpIJbGEM7GzPNhFEOfIwmvEj2VY+XsqO5WIVhC1GcEs0vr/EmESK5fgZ bTNM4PtSVeUVEvNX9dB+IDdAukp26YsbAc3QaBPcA9DOSVDJO8uV0bP6nJ9P8tAG/O eXMEzpd8QvaDhrWiGMxrvwTjIhAwNy/PbhsinL2BbdIJTkFV5HJj+l6X7SpNlebdSe ZDsh4cxGC/rKoCqxo/n4FOhXzra3G/5mklJ16QHK9oOlL8ueizdkL1qyJ2J1RxG5DD omA78TGn6J3Ka38WJAiyd5fI3EJyE4FyyP/jAa52xLXAsa2A2scwnSmfVh/pzH4qSq rMRYZHWlCmCDw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v11 2/2] vfio: selftests: Find devices that have VFIO selftest drivers Reply-To: sashiko-reviews@lists.linux.dev To: "Josh Hilke" Cc: kvm@vger.kernel.org In-Reply-To: <20261203230106.32033-3-jrhilke@google.com> References: <20261203230106.32033-1-jrhilke@google.com> <20261203230106.32033-3-jrhilke@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 23:14:04 +0000 X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] vfio: selftests: main() does not reject unexpected positional arguments - [Low] vfio: selftests: unchecked sysfs reads reuse stale IDs in scan_devices() - [Low] vfio: selftests: unquoted command substitution when sourcing lib.sh -- commit 5433f70e41c5fa212afb1ca8022908cf6396102c Author: Josh Hilke vfio: selftests: Find devices that have VFIO selftest drivers This commit adds list_supported_devices.sh to scan /sys/bus/pci/devices for devices supported by VFIO selftest drivers, installs it via the VFIO selftests Makefile, and documents it in vfio-selftests.rst. > diff --git a/tools/testing/selftests/vfio/scripts/list_supported_devices.= sh b/tools/testing/selftests/vfio/scripts/list_supported_devices.sh > new file mode 100755 > index 0000000000000..3a3ae152dfcec > --- /dev/null > +++ b/tools/testing/selftests/vfio/scripts/list_supported_devices.sh > @@ -0,0 +1,310 @@ > +#!/bin/bash > +# SPDX-License-Identifier: GPL-2.0-or-later > + > +source $(dirname -- "${BASH_SOURCE[0]}")/lib.sh [Severity: Low] Should this command substitution be quoted as source "$(dirname -- "${BASH_SOURCE[0]}")/lib.sh"? When the script lives in a path containing whitespace or glob characters, word splitting or pathname expansion causes source to fail or load the wrong file. Because set -e is not enabled, execution continues and format_device_line() calls the undefined get_driver helper, misreporting bound devices as unbound. [ ... ] > + for bdf in $(ls /sys/bus/pci/devices); do > + read -r vendor < "/sys/bus/pci/devices/${bdf}/vendor" > + read -r device < "/sys/bus/pci/devices/${bdf}/device" > + printf -v id "%04x:%04x" "${vendor}" "${device}" [Severity: Low] Can scan_devices() report a removed PCI device using the previous device's vendor and device IDs? If a device such as an SR-IOV VF disappears mid-scan, the unchecked input redirection fails before read runs. vendor and device then keep the prior iteration's values, causing the vanished BDF to be falsely reported even in -q output. Checking the redirections with 2>/dev/null || continue avoids reusing stale IDs. Similarly, is_nv_gpu() performs an unchecked read on /sys/bus/pci/devices/${bdf}/class that emits a raw shell error if the device vanishes mid-scan. [ ... ] > + while getopts "qah" opt; do > + case "${opt}" in > + q) quiet=3D"true" ;; > + a) all=3D"true" ;; > + h) usage; exit 0 ;; > + \?) usage; exit 1 ;; > + esac > + done > + > + if [ "${all}" ] && [ -z "${quiet}" ]; then [Severity: Low] Does main() silently ignore unexpected positional arguments and any flags that follow them? getopts stops parsing at the first non-option argument, so invoking the script with a BDF like "0000:00:04.0 -q" discards both arguments and prints verbose output with exit status 0 instead of failing with usage(). Running shift $((OPTIND - 1)) and rejecting $# -ne 0 would catch stray arguments. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203230106.3203= 3-1-jrhilke@google.com?part=3D2