svm: check svm_msg_q_size_to_alloc success 48/36548/1
authorOfer Heifetz <oferh@marvell.com>
Wed, 29 Jun 2022 17:18:27 +0000 (20:18 +0300)
committerOfer Heifetz <oferh@marvell.com>
Wed, 29 Jun 2022 17:21:27 +0000 (20:21 +0300)
svm_msg_q_size_to_alloc must return a valid base address, if it fails
pass up the error for handling

Type: fix

Change-Id: I408492f65f646862122acb9a187819b3bbf4f91c
Signed-off-by: Ofer Heifetz <oferh@marvell.com>
src/svm/fifo_segment.c

index 489ca2a..c2ba6c0 100644 (file)
@@ -1098,6 +1098,9 @@ fifo_segment_msg_q_alloc (fifo_segment_t *fs, u32 mq_index,
 
   size = svm_msg_q_size_to_alloc (cfg);
   base = fsh_alloc_aligned (fsh, size, 8);
+  if (!base)
+    return 0;
+
   fsh->n_reserved_bytes += size;
 
   smq = svm_msg_q_init (base, cfg);