summaryrefslogtreecommitdiff
path: root/scripts/objdiff
diff options
context:
space:
mode:
authorAvinash Duduskar <avinash.duduskar@gmail.com>2026-05-13 14:52:53 +0530
committerJakub Kicinski <kuba@kernel.org>2026-05-15 17:42:10 -0700
commit3931012141aa27c2daecaa9b19867fe50c7b7c68 (patch)
treed9f58c363a1e4acb101e49381a0dd61dcd884986 /scripts/objdiff
parente758acedce4e344e6ce290b4a422bb695dc53117 (diff)
llc: avoid sparse cast-truncates warning in counter clamps
llc_conn_ac_inc_npta_value() and llc_conn_ac_inc_tx_win_size() clamp their counters to the maximum valid 7-bit value via (u8) ~LLC_2_SEQ_NBR_MODULO. LLC_2_SEQ_NBR_MODULO is defined as ((u8) 128) in include/net/llc_pdu.h, but the (u8) cast does not prevent integer promotion of the operand of ~: ~128 is computed as int (0xffffff7f), and the surrounding (u8) cast truncates back to 0x7f. The result is correct (127), but the implicit truncation is flagged by sparse: net/llc/llc_c_ac.c:1008:38: warning: cast truncates bits from constant value (ffffff7f becomes 7f) (and three more at lines 1009, 1099, 1100) Replace the (u8) ~LLC_2_SEQ_NBR_MODULO expression with LLC_2_SEQ_NBR_MODULO - 1, which evaluates to 127 directly and silences sparse. The same ~LLC_2_SEQ_NBR_MODULO pattern also appears in include/net/llc_pdu.h:148 as part of PDU_GET_NEXT_Vr, but there the result is immediately &-masked, so the int promotion is harmless and sparse does not flag it; it is left alone. This patch is the minimum diff to silence the warning. The counter-clamp idiom itself could be modernized to min_t(u8, ..., LLC_2_SEQ_NBR_MODULO - 1), but that is a separate cleanup left for another patch. No functional change. Signed-off-by: Avinash Duduskar <avinash.duduskar@gmail.com> Link: https://patch.msgid.link/20260513092253.3035961-1-avinash.duduskar@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'scripts/objdiff')
0 files changed, 0 insertions, 0 deletions