]> git.baikalelectronics.ru Git - kernel.git/commit
overflow.h: Add arithmetic shift helper
authorJason Gunthorpe <jgg@mellanox.com>
Wed, 1 Aug 2018 21:25:39 +0000 (14:25 -0700)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 8 Aug 2018 15:47:26 +0000 (09:47 -0600)
commit4e920e04d54d3d99d692958f567f4e585fb5df4c
tree47e7adc83361508e8826065f344453ee5216f704
parente95cd780f3602b24b093650a2ca94fbcf7b9d6c3
overflow.h: Add arithmetic shift helper

Add shift_overflow() helper to assist driver authors in ensuring that
shift operations don't cause overflows or other odd conditions.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
[kees: tweaked comments and commit log, dropped unneeded assignment]
Signed-off-by: Kees Cook <keescook@chromium.org>
include/linux/overflow.h