[Sound-open-firmware] [PATCH 1/2] ipc: add missing braces for multi-line macro in block

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Thu Jan 18 21:30:59 CET 2018


Detected with Coverity and fix with braces.

Details:

Code that is meant to be executed conditionally may be executed
unconditionally

In do_notify: The indentation of this code suggests it is nested when
it is not. (CWE-483)

multi_stmt_macro: The macro on this line expands into multiple
statements, only the first of which is nested within the preceding
parent while the rest are not.

http://cwe.mitre.org/data/definitions/483.html

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
 src/ipc/byt-ipc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ipc/byt-ipc.c b/src/ipc/byt-ipc.c
index 8897bb9..b5da4b6 100644
--- a/src/ipc/byt-ipc.c
+++ b/src/ipc/byt-ipc.c
@@ -67,8 +67,9 @@ static void do_notify(void)
 		goto out;
 
 	/* copy the data returned from DSP */
-	if (msg->rx_size && msg->rx_size < SOF_IPC_MSG_MAX_SIZE)
+	if (msg->rx_size && msg->rx_size < SOF_IPC_MSG_MAX_SIZE) {
 		mailbox_dspbox_read(msg->rx_data, 0, msg->rx_size);
+	}
 
 	/* any callback ? */
 	if (msg->cb)
-- 
2.14.1



More information about the Sound-open-firmware mailing list