All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: hamohammed.sa@gmail.com
Cc: linux-media@vger.kernel.org
Subject: re: Staging: media: replace pr_* with dev_*
Date: Fri, 20 Mar 2015 01:38:10 +0300	[thread overview]
Message-ID: <20150319223810.GA13745@mwanda> (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

                 reply	other threads:[~2015-03-19 22:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150319223810.GA13745@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=hamohammed.sa@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.