mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Ingo Molnar <mingo@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Steven Whitehouse <swhiteho@redhat.com>,
	Deepa Dinamani <deepa.kernel@gmail.com>,
	Waiman Long <longman@redhat.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][-next] mqueue: fix incorrect memset size for object v
Date: Tue,  4 Jul 2017 17:09:19 +0100	[thread overview]
Message-ID: <20170704160919.19406-1-colin.king@canonical.com> (raw)

From: Colin Ian King <colin.king@canonical.com>

The size of the memset is incorrect, it is currently using the size
of attr (a struct mq_attr *) and not of v (a struct compat_mq_attr)

Detected by CoverityScan, CID#1449362 ("Wrong sizeof argument")

Fixes: 045256d59da6 ("mqueue: move compat syscalls to native ones")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 ipc/mqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index a1a326569268..c9ff943f19ab 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1449,7 +1449,7 @@ static inline int put_compat_mq_attr(const struct mq_attr *attr,
 {
 	struct compat_mq_attr v;
 
-	memset(&v, 0, sizeof(attr));
+	memset(&v, 0, sizeof(v));
 	v.mq_flags = attr->mq_flags;
 	v.mq_maxmsg = attr->mq_maxmsg;
 	v.mq_msgsize = attr->mq_msgsize;
-- 
2.11.0

             reply	other threads:[~2017-07-04 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 16:09 Colin King [this message]
2017-07-04 17:13 ` Al Viro

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=20170704160919.19406-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=deepa.kernel@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mingo@kernel.org \
    --cc=swhiteho@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®