[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] maint: avoid a -Werror=null-dereference with GCC-6.3.1
From: |
Pádraig Brady |
Subject: |
[PATCH] maint: avoid a -Werror=null-dereference with GCC-6.3.1 |
Date: |
Mon, 27 Feb 2017 00:53:15 -0800 |
* src/stty.c (sane_mode): Assert to inform the compiler
we know the pointer will be valid.
---
src/stty.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/stty.c b/src/stty.c
index 4f911a0..32007e6 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;
}
}
--
2.9.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] maint: avoid a -Werror=null-dereference with GCC-6.3.1,
Pádraig Brady <=