auxdisplay: charlcd: checking for pointer reference before dereferencing
authorLuiz Sampaio <sampaio.ime@gmail.com>
Tue, 9 Nov 2021 22:07:32 +0000 (19:07 -0300)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 24 Nov 2021 10:46:52 +0000 (11:46 +0100)
commit4daa9ff89ef27be43c15995412d6aee393a78200
tree6be42ed28dfed32cd06e1bfcf334246827a8bd3a
parent94047df12fec0e51e860b5317223f67a3ea4eb07
auxdisplay: charlcd: checking for pointer reference before dereferencing

Check if the pointer lcd->ops->init_display exists before dereferencing it.
If a driver called charlcd_init() without defining the ops, this would
return segmentation fault, as happened to me when implementing a charlcd
driver.  Checking the pointer before dereferencing protects from
segmentation fault.

Signed-off-by: Luiz Sampaio <sampaio.ime@gmail.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
drivers/auxdisplay/charlcd.c