drm/i915/reg: fix undefined behavior due to shift overflowing the constant
authorJani Nikula <jani.nikula@intel.com>
Wed, 18 May 2022 11:33:14 +0000 (14:33 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 19 May 2022 09:50:29 +0000 (12:50 +0300)
commit416e07a84f6ed883e0abd68c2fb868c80eea887b
tree057a7670985fbf3a014ee88c3c900939199be0b7
parent183f815d426b22c4424958403b096aebf3b060ca
drm/i915/reg: fix undefined behavior due to shift overflowing the constant

Use REG_GENMASK() and REG_FIELD_PREP() to avoid errors due to
-fsanitize=shift.

References: https://lore.kernel.org/r/20220405151517.29753-12-bp@alien8.de
Reported-by: Borislav Petkov <bp@suse.de>
Reported-by: Ruiqi GONG <gongruiqi1@huawei.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220518113315.1305027-1-jani.nikula@intel.com
(cherry picked from commit 230fb39ff7e07bd0324c87acf08dd2c9b0bbcea8)
drivers/gpu/drm/i915/i915_reg.h