On Mon, Nov 21, 2022 at 10:00:29AM +0800, Zeng Heng wrote: > When kvasprintf() fails to allocate memory, it would return > null-pointer. In case of null pointer dereferencing, fix it > by returning error number directly from the function. > > Fixes: 704e8953d3e9 ("PCI/irq: Add pci_request_irq() and pci_free_irq() helpers") > Signed-off-by: Zeng Heng <zengheng4@xxxxxxxxxx> Applied with Christoph's ack to pci/enumeration for v6.2, thanks! > --- > drivers/pci/irq.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c > index 12ecd0aaa28d..0050e8f6814e 100644 > --- a/drivers/pci/irq.c > +++ b/drivers/pci/irq.c > @@ -44,6 +44,8 @@ int pci_request_irq(struct pci_dev *dev, unsigned int nr, irq_handler_t handler, > va_start(ap, fmt); > devname = kvasprintf(GFP_KERNEL, fmt, ap); > va_end(ap); > + if (!devname) > + return -ENOMEM; > > ret = request_threaded_irq(pci_irq_vector(dev, nr), handler, thread_fn, > irqflags, devname, dev_id); > -- > 2.25.1 >