public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: fbdev: sis: fix potential NULL dereference in sisfb_post_sis300()
@ 2022-04-01  3:41 Haowen Bai
  2022-04-01 20:53 ` Helge Deller
  0 siblings, 1 reply; 2+ messages in thread
From: Haowen Bai @ 2022-04-01  3:41 UTC (permalink / raw)
  To: Thomas Winischhofer, Helge Deller
  Cc: Haowen Bai, linux-fbdev, dri-devel, linux-kernel

bios could be null without checking null and return in this function,
but still dereference bios[0xf5].

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 drivers/video/fbdev/sis/sis_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c
index 742f629..24a0299 100644
--- a/drivers/video/fbdev/sis/sis_main.c
+++ b/drivers/video/fbdev/sis/sis_main.c
@@ -4463,7 +4463,7 @@ static void sisfb_post_sis300(struct pci_dev *pdev)
 		SiS_SetReg(SISCR, 0x37, 0x02);
 		SiS_SetReg(SISPART2, 0x00, 0x1c);
 		v4 = 0x00; v5 = 0x00; v6 = 0x10;
-		if(ivideo->SiS_Pr.UseROM) {
+		if (ivideo->SiS_Pr.UseROM && bios) {
 			v4 = bios[0xf5];
 			v5 = bios[0xf6];
 			v6 = bios[0xf7];
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-01 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-01  3:41 [PATCH] video: fbdev: sis: fix potential NULL dereference in sisfb_post_sis300() Haowen Bai
2022-04-01 20:53 ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox