From nobody Tue Dec 16 16:41:31 2025 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 E565322D785 for ; Wed, 10 Dec 2025 21:16:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765401405; cv=none; b=UfVjAKJNTXI37Lk6aQABZBVPldbdP2t2ywiG7emZOIqe8spr2oRsDaOSnCyTDKKorUGeSHC3EUcYaeUacyB9bzZUEQfWN1GZWL+OpHebwmiWLPKPmB+aM4+JNGWGPRlC1ITFuWeRFNVhJ+uG051XuJXEpMnOG96ZiooWcBvavaA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765401405; c=relaxed/simple; bh=mr8MKA14m3hru5UbYvO5bVCKX70QVtF6+eaN8vBLjUw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=g0efTeIFltijzefNifaldz34qPD8bTFrcdsi+ArExw++rDvYSPakLvZyglQGpEfMzAihQKioiyWT2v8cinMKU1hbLaNOP3orcMhoA+yLATJrzzj+W4Aezl2CT94rM1MK1Tppcac5yw7CYkvRfsv3nph12c6/J47GmUFF1ahjy/k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nOIq7GgJ; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nOIq7GgJ" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7bb710d1d1dso370268b3a.1 for ; Wed, 10 Dec 2025 13:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765401402; x=1766006202; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=aWAaI77IK3V9A6IwXVo0vX3o908zHo/+nth9jNlQRds=; b=nOIq7GgJbajxrTEj+kkhmrVN7lhZjPOwj9Ob3F08UtuYVne2HuFTqsuj8F3V8pidL5 MsSn/LwNy96E6C6UxtoMPjX9++v3++pqyrzUfcuu/8bUdCH+PNLc9akCyj2za5Yv2F7W 2Cq0e0LzruQXfJg1x0uO3SkxoY64b/KU60txBhTWC/IzYpRHkMDx0kQwbCcRjKbD/MLK uq6EBhk2P9jjtaGWOIU/7wUksU/8j9u+98RazfhR266Van17jep4OCCBpyoYSEyegsxW B5kMiGvbZ7XwTd0JAo7H31wtLxngmGOxDzrPDJYi9dP9qIHoSYdv9DIo8IZ7+t9OD7is 0VZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765401402; x=1766006202; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aWAaI77IK3V9A6IwXVo0vX3o908zHo/+nth9jNlQRds=; b=c60axXxds3kKTi0ghWd3m3ffWN5oNMHCdC9d+AAhit7SA561vN8fc9kMDZIcM0demy 3Y5x5HWDtuKLuWuNin1Puf9OGZBWOXrermI+tSAuDAA0KnovBN0OPvyx3PEZCGGZntgs fs1wtX57KwDWtSxi6K/o983HW8xUJ/Bx10TjFhNtCk/0JeQri6eO7/Xzv6vRpyaSlkJV tPbbaF+oUJZRTqD/BIxEN561YFzjK68ucG81OoCw+2HYocnPG6oc6YHG0lZY/LxM3beQ rTFplGhgdmrQxiXhDd3m8pBIBlLK9DCfSRWV0IfXATJMsjkYXiEGDvMPXCuWNBrSHk6l Lcxg== X-Forwarded-Encrypted: i=1; AJvYcCVMNGlOZJE9qrWMeTsRcsIJBsel5zMCNE1vudayFkdKJ9bQfvVoq5//hSM99tQo2ZXPlDg4K08wS/s7mEU=@vger.kernel.org X-Gm-Message-State: AOJu0YwSpdQMxKZg3rfeAVqHjO8a2gHminhppST2PDiKcgz/pUy6X9Ow FlhLi7lu+SSWQF3WacS/OyladA0pg+sDsi0IF8s+QjegL9QucrJpyN6y X-Gm-Gg: ASbGncuggnH44twghWtTgm4i502EfSZFmE20JzdavICea8ArWeusCWmVeoqCkwfbl7K 8v+FBZEtTGKKGdukKK6Yj97umqsVN1jc0bPw9GmC8hTSODoUpmD9ICrGqArwK1xvApiBaI9BZ8R juhqnUoF5PexQCvYwrlMif42ag8rMC79UaaFFoFEfe4R/s1+ohSiYaZ5NQrSEeeCQsbnHdHq457 VrFWuFwqRjK6G+cd6M1pCIhWY8oZVtmSMLie9uZ0bbrQ5nEc17H6MJUOsXwk7IOeb1r6A1Aw4L2 DYYizv9m/+nVnC9HQuowCG4VW4ENKLwiKmsKoC25Y9ussYhbGL0TSLqR0J0t8kCC3w5Onk8bYDz R0UmcTD5G+StihcNtyAA5J6/N3Du9WaXo6sv3C05cwQjLVZpZ7SYvF0uNz77xzc7tAK9dmw4d5P EnGv57aGcpR1Rk+7DEfyjyLuawuHEjUx0KOFTyN+4= X-Google-Smtp-Source: AGHT+IE2ULD1yYKY6ybGe7FNDn2kZdxGAEF3Iv6t0/+g1Icyf6iWWfIVjfCStoCP7aC+K+nu1WterQ== X-Received: by 2002:a05:6a00:2789:b0:7b8:16af:3bbc with SMTP id d2e1a72fcca58-7f22d3023famr3337030b3a.31.1765401402189; Wed, 10 Dec 2025 13:16:42 -0800 (PST) Received: from localhost.localdomain ([202.164.139.255]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7f4c4aa717fsm424373b3a.36.2025.12.10.13.16.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 13:16:41 -0800 (PST) Received: (nullmailer pid 989870 invoked by uid 1000); Wed, 10 Dec 2025 21:13:57 -0000 From: Kathara Sasikumar To: jgg@ziepe.ca, kevin.tian@intel.com, shuah@kernel.org Cc: iommu@lists.linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, yi.l.liu@intel.com, nicolinc@nvidia.com, alex.williamson@redhat.com, katharaasasikumar007@gmail.com, Kathara Sasikumar Subject: [PATCH] selftests: iommu: fix Warray-bounds in get_hw_info test Date: Wed, 10 Dec 2025 21:13:42 +0000 Message-ID: <20251210211342.989850-1-katharasasikumar007@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The get_hw_info uses a smaller user buffer on purpose to check how the kernel updates only the fields that fit in the buffer. The test created a custom smaller struct for this, but the helper function later treats the buffer as struct iommu_test_hw_info. This makes the compiler warn about a possible out-of-bounds access (-Warray-bounds). This keeps the test behavior the same and removes the warning. Signed-off-by: Kathara Sasikumar --- tools/testing/selftests/iommu/iommufd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/testing/selftests/iommu/iommufd.c b/tools/testing/selfte= sts/iommu/iommufd.c index 10e051b6f592..f6aceb65313f 100644 --- a/tools/testing/selftests/iommu/iommufd.c +++ b/tools/testing/selftests/iommu/iommufd.c @@ -755,9 +755,7 @@ TEST_F(iommufd_ioas, get_hw_info) struct iommu_test_hw_info info; uint64_t trailing_bytes; } buffer_larger; - struct iommu_test_hw_info_buffer_smaller { - __u32 flags; - } buffer_smaller; + struct iommu_test_hw_info buffer_smaller; =20 if (self->device_id) { uint8_t max_pasid =3D 0; --=20 2.51.0