mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: vt6655: wmgr.c:  Fix for possible null pointer dereference
@ 2014-12-14 22:42 Rickard Strandqvist
  2014-12-14 22:52 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Rickard Strandqvist @ 2014-12-14 22:42 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman
  Cc: Rickard Strandqvist, Malcolm Priestley, Guillaume Clement,
	Guido Martínez, Paul E. McKenney, Himangi Saraogi,
	Joe Perches, devel, linux-kernel

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/staging/vt6655/wmgr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index c73c39d..f98935c 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -4391,7 +4391,7 @@ bAdd_PMKID_Candidate(
 	unsigned int ii = 0;
 
 	pr_debug("bAdd_PMKID_Candidate START: (%d)\n",
-		 (int)pDevice->gsPMKIDCandidate.NumCandidates);
+		(int)(pDevice ? pDevice->gsPMKIDCandidate.NumCandidates : 0));
 
 	if ((pDevice == NULL) || (pbyBSSID == NULL) || (psRSNCapObj == NULL))
 		return false;
-- 
1.7.10.4


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

* Re: [PATCH] staging: vt6655: wmgr.c:  Fix for possible null pointer dereference
  2014-12-14 22:42 [PATCH] staging: vt6655: wmgr.c: Fix for possible null pointer dereference Rickard Strandqvist
@ 2014-12-14 22:52 ` Joe Perches
  2014-12-14 22:55   ` Rickard Strandqvist
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2014-12-14 22:52 UTC (permalink / raw)
  To: Rickard Strandqvist
  Cc: Forest Bond, Greg Kroah-Hartman, Malcolm Priestley,
	Guillaume Clement, Guido Martínez, Paul E. McKenney,
	Himangi Saraogi, devel, linux-kernel

On Sun, 2014-12-14 at 23:42 +0100, Rickard Strandqvist wrote:
> There is otherwise a risk of a possible null pointer dereference.
> Was largely found by using a static code analysis program called cppcheck.
[]
> diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
[]
> @@ -4391,7 +4391,7 @@ bAdd_PMKID_Candidate(
>  	unsigned int ii = 0;
>  
>  	pr_debug("bAdd_PMKID_Candidate START: (%d)\n",
> -		 (int)pDevice->gsPMKIDCandidate.NumCandidates);
> +		(int)(pDevice ? pDevice->gsPMKIDCandidate.NumCandidates : 0));

This is a function tracing printk.
I think it's better to just remove it.




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

* Re: [PATCH] staging: vt6655: wmgr.c: Fix for possible null pointer dereference
  2014-12-14 22:52 ` Joe Perches
@ 2014-12-14 22:55   ` Rickard Strandqvist
  0 siblings, 0 replies; 3+ messages in thread
From: Rickard Strandqvist @ 2014-12-14 22:55 UTC (permalink / raw)
  To: Joe Perches
  Cc: Forest Bond, Greg Kroah-Hartman, Malcolm Priestley,
	Guillaume Clement, Guido Martínez, Paul E. McKenney,
	Himangi Saraogi, devel, linux-kernel

Hi

Ok, if you want, otherwise we can put it after the NULL check?

Kind regards
Rickard Strandqvist


2014-12-14 23:52 GMT+01:00 Joe Perches <joe@perches.com>:
> On Sun, 2014-12-14 at 23:42 +0100, Rickard Strandqvist wrote:
>> There is otherwise a risk of a possible null pointer dereference.
>> Was largely found by using a static code analysis program called cppcheck.
> []
>> diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
> []
>> @@ -4391,7 +4391,7 @@ bAdd_PMKID_Candidate(
>>       unsigned int ii = 0;
>>
>>       pr_debug("bAdd_PMKID_Candidate START: (%d)\n",
>> -              (int)pDevice->gsPMKIDCandidate.NumCandidates);
>> +             (int)(pDevice ? pDevice->gsPMKIDCandidate.NumCandidates : 0));
>
> This is a function tracing printk.
> I think it's better to just remove it.
>
>
>

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

end of thread, other threads:[~2014-12-14 22:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-14 22:42 [PATCH] staging: vt6655: wmgr.c: Fix for possible null pointer dereference Rickard Strandqvist
2014-12-14 22:52 ` Joe Perches
2014-12-14 22:55   ` Rickard Strandqvist

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

all inboxes | Powered by JetHome®