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 08:00:46 +0000 (11:00 +0300)
commit230fb39ff7e07bd0324c87acf08dd2c9b0bbcea8
treed98cc4da24e2b35b07de5efa62d2039007527f3a
parentd6774b8c3c5813aa541c9148f641d3d8d4b296d2
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
drivers/gpu/drm/i915/i915_reg.h