On Wed, 2019-03-06 at 14:37 +-0200, Leon Romanovsky wrote: +AD4 From: Leon Romanovsky +ADw-leonro+AEA-mellanox.com+AD4 +AD4 +AD4 Attempt to use check+AF8-shl+AF8-overflow() with inputs of unsigned type +AD4 produces the following compilation warnings. +AD4 +AD4 drivers/infiniband/hw/mlx5/qp.c: In function +AF8-set+AF8-user+AF8-rq+AF8-size+AF8: +AD4 ./include/linux/overflow.h:230:6: warning: comparison of unsigned +AD4 expression +AD4APQ 0 is always true +AFs--Wtype-limits+AF0 +AD4 +AF8-s +AD4APQ 0 +ACYAJg +AF8-s +ADw 8 +ACo sizeof(+ACo-d) ? +AF8-s : 0+ADs +AFw +AD4 +AF4Afg +AD4 drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro +AF8-check+AF8-shl+AF8-overflow+AF8 +AD4 if (check+AF8-shl+AF8-overflow(rwq-+AD4-wqe+AF8-count, rwq-+AD4-wqe+AF8-shift, +AD4 +ACY-rwq-+AD4-buf+AF8-size)) +AD4 +AF4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+ +AD4 ./include/linux/overflow.h:232:26: warning: comparison of unsigned expression +ADw 0 is always false +AFs--Wtype-limits+AF0 +AD4 (+AF8-to+AF8-shift +ACEAPQ +AF8-s +AHwAfA +ACoAXw-d +ADw 0 +AHwAfA +AF8-a +ADw 0 +AHwAfA +AFw +AD4 +AF4 +AD4 drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro +AF8-check+AF8-shl+AF8-overflow+AF8 +AD4 if (check+AF8-shl+AF8-overflow(rwq-+AD4-wqe+AF8-count, rwq-+AD4-wqe+AF8-shift, +ACY-rwq-+AD4-buf+AF8-size)) +AD4 +AF4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+ +AD4 ./include/linux/overflow.h:232:36: warning: comparison of unsigned expression +ADw 0 is always false +AFs--Wtype-limits+AF0 +AD4 (+AF8-to+AF8-shift +ACEAPQ +AF8-s +AHwAfA +ACoAXw-d +ADw 0 +AHwAfA +AF8-a +ADw 0 +AHwAfA +AFw +AD4 +AF4 +AD4 drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro +AF8-check+AF8-shl+AF8-overflow+AF8 +AD4 if (check+AF8-shl+AF8-overflow(rwq-+AD4-wqe+AF8-count, rwq-+AD4-wqe+AF8-shift,+ACY-rwq-+AD4-buf+AF8-size)) +AD4 +AF4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+AH4AfgB+ +AD4 +AD4 Fixes: 0c66847793d1 (+ACI-overflow.h: Add arithmetic shift helper+ACI) +AD4 Signed-off-by: Leon Romanovsky +ADw-leonro+AEA-mellanox.com+AD4 +AD4 --- +AD4 Changelog v0-+AD4-v1: +AD4 +ACo fixed wrong checks +AD4 --- +AD4 include/linux/overflow.h +AHw 6 +-+-+---- +AD4 1 file changed, 3 insertions(+-), 3 deletions(-) +AD4 +AD4 diff --git a/include/linux/overflow.h b/include/linux/overflow.h +AD4 index 40b48e2133cb..a47fb6046c0a 100644 +AD4 --- a/include/linux/overflow.h +AD4 +-+-+- b/include/linux/overflow.h +AD4 +AEAAQA -227,10 +-227,10 +AEAAQA +AD4 typeof(d) +AF8-d +AD0 d+ADs +AFw +AD4 u64 +AF8-a+AF8-full +AD0 +AF8-a+ADs +AFw +AD4 unsigned int +AF8-to+AF8-shift +AD0 +AFw +AD4 - +AF8-s +AD4APQ 0 +ACYAJg +AF8-s +ADw 8 +ACo sizeof(+ACo-d) ? +AF8-s : 0+ADs +AFw +AD4 +- (+AF8-s +AD0APQ 0 +AHwAfA +AF8-s +AD4 0) +ACYAJg +AF8-s +ADw 8 +ACo sizeof(+ACo-d) ? +AF8-s : 0+ADs +AFw +AD4 +ACoAXw-d +AD0 (+AF8-a+AF8-full +ADwAPA +AF8-to+AF8-shift)+ADs +AFw +AD4 - (+AF8-to+AF8-shift +ACEAPQ +AF8-s +AHwAfA +ACoAXw-d +ADw 0 +AHwAfA +AF8-a +ADw 0 +AHwAfA +AFw +AD4 - (+ACoAXw-d +AD4APg +AF8-to+AF8-shift) +ACEAPQ +AF8-a)+ADs +AFw +AD4 +- (+AF8-to+AF8-shift +ACEAPQ +AF8-s +AHwAfA +ACE(+ACoAXw-d +AD4 0 +AHwAfA +ACoAXw-d +AD0APQ 0) +AHwAfA +AFw +AD4 +- +ACE(+AF8-a +AD4 0 +AHwAfA +AF8-a +AD0APQ 0) +AHwAfA (+ACoAXw-d +AD4APg +AF8-to+AF8-shift) +ACEAPQ +AF8-a)+ADs +AFw +AD4 +AH0) +AD4 +AD4 /+ACoAKg Reviewed-by: Bart Van Assche +ADw-bvanassche+AEA-acm.org+AD4-