xen/xsm: flask: Check xmalloc_array() return in security_sid_to_context()
PATCH 1/1 xen/xsm: flask: Check xmalloc_array() return in security_sid_to_context()
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
--- xen/xsm/flask/ss/services.c | 2 ++ 1 file changed, 2 insertions(+)
xen/xsm/flask/ss/services.c +2 -0
@@ -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;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Julien Grall
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 <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Julien Grall
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 <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel