lkml.org 
[lkml]   [2014]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] staging: line6: toneport.c: Fix for possible null pointer dereference
Date
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/line6/toneport.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c
index af2e7e5..36fe76d 100644
--- a/drivers/staging/line6/toneport.c
+++ b/drivers/staging/line6/toneport.c
@@ -431,11 +431,15 @@ void line6_toneport_disconnect(struct usb_interface *interface)
{
struct usb_line6_toneport *toneport;
u16 idProduct;
+ struct snd_line6_pcm *line6pcm;

if (interface == NULL)
return;

toneport = usb_get_intfdata(interface);
+ if (toneport == NULL)
+ return;
+
del_timer_sync(&toneport->timer);
idProduct = le16_to_cpu(toneport->line6.usbdev->descriptor.idProduct);

@@ -444,13 +448,11 @@ void line6_toneport_disconnect(struct usb_interface *interface)
device_remove_file(&interface->dev, &dev_attr_led_green);
}

- if (toneport != NULL) {
- struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm;
+ line6pcm = toneport->line6.line6pcm;

- if (line6pcm != NULL) {
- line6_pcm_release(line6pcm, LINE6_BITS_PCM_MONITOR);
- line6_pcm_disconnect(line6pcm);
- }
+ if (line6pcm != NULL) {
+ line6_pcm_release(line6pcm, LINE6_BITS_PCM_MONITOR);
+ line6_pcm_disconnect(line6pcm);
}

toneport_destruct(interface);
--
1.7.10.4


\
 
 \ /
  Last update: 2014-05-20 00:21    [W:0.053 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site