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)
commit0c66847793d1982d1083dc6f7adad60fa265ce9c
tree47e7adc83361508e8826065f344453ee5216f704
parent58796e67d5d529e2010f6985fae7a5cef02f19a8
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