UPSTREAM: acpigen: Fix ?: operator confusion

strlen(string) was on the negative side of the selection operator, the
side where string is NULL.

Change-Id: Ic421a5406ef788c504e30089daeba61a195457ae
Reported-by: Coverity Scan (CID 1355263)
Original-Signed-off-by: Jonathan Neuschfer <j.neuschaefer@gmx.net>
Original-Reviewed-on: https://review.coreboot.org/14867
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-by: Duncan Laurie <dlaurie@google.com>
(cherry-picked from commit 0ba307f0fe)
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/346610
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Jonathan Neuschäfer 2016-05-17 17:40:09 +02:00 committed by chrome-bot
commit 6fbee124b2

View file

@ -206,7 +206,7 @@ void acpigen_emit_stream(const char *data, int size)
void acpigen_emit_string(const char *string)
{
acpigen_emit_stream(string, string ? 0 : strlen(string));
acpigen_emit_stream(string, string ? strlen(string) : 0);
acpigen_emit_byte('\0'); /* NUL */
}