* [Xen-devel] [PATCH for-4.13] xen/xsm: flask: Check xmalloc_array() return in security_sid_to_context()
@ 2019-10-04 16:56 Julien Grall
2019-10-04 17:57 ` Daniel De Graaf
2019-10-07 6:46 ` Jürgen Groß
0 siblings, 2 replies; 3+ messages in thread
From: Julien Grall @ 2019-10-04 16:56 UTC (permalink / raw)
To: xen-devel; +Cc: jgross, Julien Grall, Daniel De Graaf
xmalloc_array() may return NULL if there are memory. Rather than trying
to deference it directly, we should check the return value first.
Coverity-ID: 1381852
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
xen/xsm/flask/ss/services.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xen/xsm/flask/ss/services.c b/xen/xsm/flask/ss/services.c
index b59928ea8a..42686535f2 100644
--- a/xen/xsm/flask/ss/services.c
+++ b/xen/xsm/flask/ss/services.c
@@ -775,6 +775,8 @@ int security_sid_to_context(u32 sid, char **scontext, u32 *scontext_len)
*scontext_len = strlen(initial_sid_to_string[sid]) + 1;
scontextp = xmalloc_array(char, *scontext_len);
+ if ( !scontextp )
+ return -ENOMEM;
strlcpy(scontextp, initial_sid_to_string[sid], *scontext_len);
*scontext = scontextp;
goto out;
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Xen-devel] [PATCH for-4.13] xen/xsm: flask: Check xmalloc_array() return in security_sid_to_context()
2019-10-04 16:56 [Xen-devel] [PATCH for-4.13] xen/xsm: flask: Check xmalloc_array() return in security_sid_to_context() Julien Grall
@ 2019-10-04 17:57 ` Daniel De Graaf
2019-10-07 6:46 ` Jürgen Groß
1 sibling, 0 replies; 3+ messages in thread
From: Daniel De Graaf @ 2019-10-04 17:57 UTC (permalink / raw)
To: Julien Grall, xen-devel; +Cc: jgross
On 10/4/19 12:56 PM, Julien Grall wrote:
> xmalloc_array() may return NULL if there are memory. Rather than trying
> to deference it directly, we should check the return value first.
>
> Coverity-ID: 1381852
> Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Xen-devel] [PATCH for-4.13] xen/xsm: flask: Check xmalloc_array() return in security_sid_to_context()
2019-10-04 16:56 [Xen-devel] [PATCH for-4.13] xen/xsm: flask: Check xmalloc_array() return in security_sid_to_context() Julien Grall
2019-10-04 17:57 ` Daniel De Graaf
@ 2019-10-07 6:46 ` Jürgen Groß
1 sibling, 0 replies; 3+ messages in thread
From: Jürgen Groß @ 2019-10-07 6:46 UTC (permalink / raw)
To: Julien Grall, xen-devel; +Cc: Daniel De Graaf
On 04.10.19 18:56, Julien Grall wrote:
> xmalloc_array() may return NULL if there are memory. Rather than trying
> to deference it directly, we should check the return value first.
>
> Coverity-ID: 1381852
> Signed-off-by: Julien Grall <julien.grall@arm.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-07 6:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 16:56 [Xen-devel] [PATCH for-4.13] xen/xsm: flask: Check xmalloc_array() return in security_sid_to_context() Julien Grall
2019-10-04 17:57 ` Daniel De Graaf
2019-10-07 6:46 ` Jürgen Groß
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.