selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyongjun1@huawei.com>
To: Paul Moore <paul@paul-moore.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	Eric Paris <eparis@parisplace.org>,
	peter enderborg <peter.enderborg@sony.com>,
	Kent Overstreet <kent.overstreet@gmail.com>,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Ondrej Mosnacek <omosnace@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, <selinux@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>
Subject: [PATCH -next] selinux: Fix error return code in policydb_read()
Date: Fri, 18 Jan 2019 14:23:47 +0000	[thread overview]
Message-ID: <1547821427-157169-1-git-send-email-weiyongjun1@huawei.com> (raw)

Fix to return a negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 31696241e96e ("selinux: convert to kvmalloc")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 security/selinux/ss/policydb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 6b576e5..ef616dd 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -2490,6 +2490,7 @@ int policydb_read(struct policydb *p, void *fp)
 	if (rc)
 		goto bad;
 
+	rc = -ENOMEM;
 	p->type_attr_map_array = kvcalloc(p->p_types.nprim,
 					  sizeof(*p->type_attr_map_array),
 					  GFP_KERNEL);




             reply	other threads:[~2019-01-18 14:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 14:23 Wei Yongjun [this message]
2019-01-18 21:28 ` [PATCH -next] selinux: Fix error return code in policydb_read() Paul Moore
2019-01-19  0:21   ` Stephen Rothwell
2019-01-20 20:04     ` Stephen Rothwell
2019-01-22 17:39       ` Paul Moore
2019-01-25 21:59         ` Paul Moore
  -- strict thread matches above, loose matches on Subject: below --
2020-04-29  7:30 [PATCH -next] selinux: fix " Wei Yongjun
2020-04-29 13:07 ` Dan Carpenter
2020-04-29 13:32   ` Ondrej Mosnacek
2020-04-29 13:47     ` Dan Carpenter
2020-05-01 19:08     ` Paul Moore
2020-05-01 19:52       ` Ondrej Mosnacek
2020-05-01 16:46   ` Paul Moore
2020-05-04 19:17     ` Dan Carpenter
2020-05-01 19:04 ` Paul Moore
2016-09-10  7:43 [PATCH -next] SELinux: " Wei Yongjun
2016-09-13 21:19 ` Paul Moore

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=1547821427-157169-1-git-send-email-weiyongjun1@huawei.com \
    --to=weiyongjun1@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=eparis@parisplace.org \
    --cc=kent.overstreet@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=peter.enderborg@sony.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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;
as well as URLs for NNTP newsgroup(s).