All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: ipc: cleanup do_msgrcv() aroung MSG_COPY feature
Date: Mon, 05 Nov 2012 11:21:45 +0000	[thread overview]
Message-ID: <20121105112145.GA11530@elgon.mountain> (raw)

Hello Stanislav Kinsbursky,

This is a semi-automatic email about new static checker warnings.

The patch 6645154dd758: "ipc: cleanup do_msgrcv() aroung MSG_COPY 
feature" from Nov 3, 2012, leads to the following Smatch complaint:

ipc/msg.c:878 do_msgrcv()
	 error: we previously assumed 'msg' could be null (see line 865)

ipc/msg.c
   861                                  } else if (msgflg & MSG_COPY) {
   862                                          msg = fill_copy(copy_number,
   863                                                          msg_counter,
   864                                                          walk_msg, copy);
   865						if (msg)
                                                   ^^^^
New check.  fill_copy() either returns an error pointer, a valid pointer
or NULL.

   866							break;
   867					} else
   868						break;
   869					msg_counter++;
   870				}
   871				tmp = tmp->next;
   872			}
   873			if (!IS_ERR(msg)) {
   874				/*
   875				 * Found a suitable message.
   876				 * Unlink it from the queue.
   877				 */
   878				if ((bufsz < msg->m_ts) && !(msgflg & MSG_NOERROR)) {
                                             ^^^^^
Old dereference.

   879					msg = ERR_PTR(-E2BIG);
   880					goto out_unlock;

regards,
dan carpenter

                 reply	other threads:[~2012-11-05 11:21 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=20121105112145.GA11530@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@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.