From: Pádraig Brady
Date: Mon, 27 Feb 2017 08:47:30 +0000 (-0800) Subject: maint: avoid a -Werror=null-dereference with GCC-6.3.1 X-Git-Tag: v8.27~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=06c3123f6eeecd0ef2698504c3da76834acac8db;p=thirdparty%2Fcoreutils.git maint: avoid a -Werror=null-dereference with GCC-6.3.1 * src/stty.c (sane_mode): Assert to inform the compiler we know the pointer will be valid. --- diff --git a/src/stty.c b/src/stty.c index 4f911a0063..32007e6df7 100644 --- a/src/stty.c +++ b/src/stty.c @@ -2268,11 +2268,13 @@ sane_mode (struct termios *mode) if (mode_info[i].flags & SANE_SET) { bitsp = mode_type_flag (mode_info[i].type, mode); + assert (bitsp); /* combination modes will not have SANE_SET. */ *bitsp = (*bitsp & ~mode_info[i].mask) | mode_info[i].bits; } else if (mode_info[i].flags & SANE_UNSET) { bitsp = mode_type_flag (mode_info[i].type, mode); + assert (bitsp); /* combination modes will not have SANE_UNSET. */ *bitsp = *bitsp & ~mode_info[i].mask & ~mode_info[i].bits; } }