mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
gnss: fix potential error pointer dereference
The gnss_allocate_device() function returns a mix of NULL and error
pointers on error. It should only return one or the other. Since the
callers both check for NULL, I've modified it to return NULL on error.
Fixes: 2b6a440351 ("gnss: add GNSS receiver subsystem")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
55570f1a44
commit
d9995a0fab
1 changed files with 2 additions and 2 deletions
|
|
@ -235,7 +235,7 @@ struct gnss_device *gnss_allocate_device(struct device *parent)
|
|||
id = ida_simple_get(&gnss_minors, 0, GNSS_MINORS, GFP_KERNEL);
|
||||
if (id < 0) {
|
||||
kfree(gdev);
|
||||
return ERR_PTR(id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gdev->id = id;
|
||||
|
|
@ -270,7 +270,7 @@ struct gnss_device *gnss_allocate_device(struct device *parent)
|
|||
err_put_device:
|
||||
put_device(dev);
|
||||
|
||||
return ERR_PTR(-ENOMEM);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gnss_allocate_device);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue