Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: add assertion for checking null edid to drm_edid_block_valid

If raw_edid of drm_edid_block_vaild() is null, it will crash, so
checking in bad label is removed and instead assertion is added at
the top of the function.
The type of return for the function is bool, so it fixes to return
true and false instead of 1 and 0.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Seung-Woo Kim and committed by
Dave Airlie
fe2ef780 cf4b91f2

+6 -3
+6 -3
drivers/gpu/drm/drm_edid.c
··· 968 968 u8 csum = 0; 969 969 struct edid *edid = (struct edid *)raw_edid; 970 970 971 + if (WARN_ON(!raw_edid)) 972 + return false; 973 + 971 974 if (edid_fixup > 8 || edid_fixup < 0) 972 975 edid_fixup = 6; 973 976 ··· 1013 1010 break; 1014 1011 } 1015 1012 1016 - return 1; 1013 + return true; 1017 1014 1018 1015 bad: 1019 - if (raw_edid && print_bad_edid) { 1016 + if (print_bad_edid) { 1020 1017 printk(KERN_ERR "Raw EDID:\n"); 1021 1018 print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, 1022 1019 raw_edid, EDID_LENGTH, false); 1023 1020 } 1024 - return 0; 1021 + return false; 1025 1022 } 1026 1023 EXPORT_SYMBOL(drm_edid_block_valid); 1027 1024