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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jan 2022 14:35:17 +0000 (15:35 +0100)
commit4ed66cdc542fdb948d67f2254fdac4106786a76e
treee8ec086e6cbcf51c8bf4f3ca2108a07b937d7a7a
parent8a7520c49994ab1d43221e6445252e9fad0b3391
auxdisplay: charlcd: checking for pointer reference before dereferencing

[ Upstream commit 4daa9ff89ef27be43c15995412d6aee393a78200 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/auxdisplay/charlcd.c