[PATCH] devtools: fix packed attribute check false positive
Jiawen Wu
jiawenwu at trustnetic.com
Thu Nov 5 02:45:50 CET 2026
check_packed_attributes() counts __rte_packed_begin and __rte_packed_end
in the whole patch text, including the hunk headers git generates. Git
labels a hunk with the nearest preceding line that starts in the first
column, so when a patch adds a struct right after an existing packed
struct, that label is the struct's own opening line and carries the
marker. The occurrence in the header is counted, the two counts differ,
and a patch whose added lines are balanced is rejected with
__rte_packed_begin and __rte_packed_end should always be used in pairs.
The trailing part of a hunk header is informational, so it should not
contribute to the counts. Restrict both greps to added lines, as the
check above already does.
Fixes: fac4bc0d06c9 ("eal: add packing macros for MSVC")
Cc: stable at dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu at trustnetic.com>
---
devtools/checkpatches.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index c52fb5d1b6..ab3c51e0f1 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -395,8 +395,8 @@ check_packed_attributes() { # <patch>
res=1
fi
- begin_count=$(grep '__rte_packed_begin' "$1" | wc -l)
- end_count=$(grep '__rte_packed_end' "$1" | wc -l)
+ begin_count=$(grep -E '^\+.*__rte_packed_begin' "$1" | wc -l)
+ end_count=$(grep -E '^\+.*__rte_packed_end' "$1" | wc -l)
if [ $begin_count != $end_count ]; then
echo "__rte_packed_begin and __rte_packed_end should always be used in pairs."
res=1
--
2.51.0
More information about the stable
mailing list