Skip to contentSkip to conversation

Staging: media: replace pr_* with dev_*

DISCUSSION Dan Carpenter 1 participant 1 message Mar 19, 2015 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello Haneen Mohammed,

The patch 2c9356d115c9: "Staging: media: replace pr_* with dev_*" from Mar 18, 2015, leads to the following static checker warning:

drivers/staging/media/lirc/lirc_sasem.c:176 delete_context()
error: dereferencing freed memory 'context'

drivers/staging/media/lirc/lirc_sasem.c
166 static void delete_context(struct sasem_context *context) 167 {

   168          usb_free_urb(context->tx_urb);  /* VFD */
   169          usb_free_urb(context->rx_urb);  /* IR */
   170          lirc_buffer_free(context->driver->rbuf);
   171          kfree(context->driver->rbuf);
   172          kfree(context->driver);
   173          kfree(context);
                      ^^^^^^^

Free.

174
175 if (debug)
176 dev_info(&context->dev->dev, "%s: context deleted\n",

                                  ^^^^^^^^^^^^^^^^^

Use after free. We could go back to pr_info(), or move this in front of the free or probably the best option is just to delete the printk. It doesn't look very useful.

177 __func__);
178 }

regards,
dan carpenter