Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1615917

[PATCH 3/3] selinux: Use an other error code for an input validation failure in sidtab_insert()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 3/3] selinux: Use an other error code for an input validation failure in sidtab_insert()
Date 2017-04-04 13:20 +0200
Message-ID <tsuFc-478-19@gated-at.bofh.it> (permalink)
References <sZUrL-3Jh-9@gated-at.bofh.it> <tsuFb-478-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 4 Apr 2017 12:23:41 +0200

The error code "-ENOMEM" was also returned so far when the parameter "s"
of this function contained a null pointer.
Now I find that the code "-EINVAL" is more appropriate in this case.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 security/selinux/ss/sidtab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c
index c5f436b15d19..2eb2a54b88d2 100644
--- a/security/selinux/ss/sidtab.c
+++ b/security/selinux/ss/sidtab.c
@@ -36,7 +36,7 @@ int sidtab_insert(struct sidtab *s, u32 sid, struct context *context)
 	struct sidtab_node *prev, *cur, *newnode;
 
 	if (!s)
-		return -ENOMEM;
+		return -EINVAL;
 
 	hvalue = SIDTAB_HASH(sid);
 	prev = NULL;
-- 
2.12.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] SELinux: Fine-tuning for two function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-04 13:20 +0200
  [PATCH 1/3] selinux: Return directly after a failed memory allocation  in policydb_index() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-04 13:20 +0200
  [PATCH 3/3] selinux: Use an other error code for an input validation  failure in sidtab_insert() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-04 13:20 +0200
  [PATCH 2/3] selinux: Return an error code only as a constant in  sidtab_insert() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-04 13:20 +0200

csiph-web