linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hgafb: fix probe function
@ 2021-05-17  8:50 Dan Carpenter
  2021-05-21 12:54 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-05-17  8:50 UTC (permalink / raw)
  To: Ferenc Bakonyi, Igor Matheus Andrade Torrente
  Cc: Greg Kroah-Hartman, linux-nvidia, dri-devel, linux-fbdev,
	kernel-janitors

There is a reversed if statement in this probe function so the driver is
completely broken.

Fixes: dc13cac4862c ("video: hgafb: fix potential NULL pointer dereference")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/video/fbdev/hgafb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c
index cc8e62ae93f6..bd3d07aa4f0e 100644
--- a/drivers/video/fbdev/hgafb.c
+++ b/drivers/video/fbdev/hgafb.c
@@ -558,7 +558,7 @@ static int hgafb_probe(struct platform_device *pdev)
 	int ret;
 
 	ret = hga_card_detect();
-	if (!ret)
+	if (ret)
 		return ret;
 
 	printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n",
-- 
2.30.2


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

* Re: [PATCH] hgafb: fix probe function
  2021-05-17  8:50 [PATCH] hgafb: fix probe function Dan Carpenter
@ 2021-05-21 12:54 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-21 12:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ferenc Bakonyi, Igor Matheus Andrade Torrente, linux-nvidia,
	dri-devel, linux-fbdev, kernel-janitors

On Mon, May 17, 2021 at 11:50:32AM +0300, Dan Carpenter wrote:
> There is a reversed if statement in this probe function so the driver is
> completely broken.
> 
> Fixes: dc13cac4862c ("video: hgafb: fix potential NULL pointer dereference")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/video/fbdev/hgafb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/hgafb.c b/drivers/video/fbdev/hgafb.c
> index cc8e62ae93f6..bd3d07aa4f0e 100644
> --- a/drivers/video/fbdev/hgafb.c
> +++ b/drivers/video/fbdev/hgafb.c
> @@ -558,7 +558,7 @@ static int hgafb_probe(struct platform_device *pdev)
>  	int ret;
>  
>  	ret = hga_card_detect();
> -	if (!ret)
> +	if (ret)
>  		return ret;
>  
>  	printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n",
> -- 
> 2.30.2
> 

Someone _just_ beat you to this:
	https://lore.kernel.org/r/20210516192714.25823-1-mail@anirudhrb.com

I'll add your s-o-b to that one as it's identical to yours.

thanks,

greg k-h


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

end of thread, other threads:[~2021-05-21 12:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17  8:50 [PATCH] hgafb: fix probe function Dan Carpenter
2021-05-21 12:54 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).