[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220907023642.2333-1-liubo03@inspur.com>
Date: Tue, 6 Sep 2022 22:36:42 -0400
From: Bo Liu <liubo03@...pur.com>
To: <sudipm.mukherjee@...il.com>, <arnd@...db.de>,
<gregkh@...uxfoundation.org>
CC: <linux-kernel@...r.kernel.org>, Bo Liu <liubo03@...pur.com>
Subject: [PATCH] ppdev: check ida_simple_get() return value
As ida_simple_get() can fail, we should check the return value.
Signed-off-by: Bo Liu <liubo03@...pur.com>
---
drivers/char/ppdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index 38b46c7d1737..13b58b6823ee 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -300,6 +300,11 @@ static int register_device(int minor, struct pp_struct *pp)
}
index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
+ if (index < 0) {
+ rc = index;
+ goto err;
+ }
+
memset(&ppdev_cb, 0, sizeof(ppdev_cb));
ppdev_cb.irq_func = pp_irq;
ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
--
2.27.0
Powered by blists - more mailing lists