]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
overflow.h: Add arithmetic shift helper
authorJason Gunthorpe <jgg@mellanox.com>
Wed, 1 Aug 2018 21:25:39 +0000 (14:25 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2020 15:23:10 +0000 (17:23 +0200)
commite00b056f7b3ae44498b787eccb452af6db902136
tree05393a97a7fcaac612f844f1350ed5d2f8653cac
parentfcef2fd098700231eec3e490a182cc1ccf8533c4
overflow.h: Add arithmetic shift helper

commit 0c66847793d1982d1083dc6f7adad60fa265ce9c upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/overflow.h