diff options
author | Theodore Ts'o <tytso@mit.edu> | 2018-06-24 00:39:37 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-06-24 00:39:37 -0400 |
commit | 366d526f15ef06c0a832dee4abe2a0c0349adb92 (patch) | |
tree | 97b2c4565084d475e4892db36c2410d520a8e73d /debugfs | |
parent | 72e854c3ad7b9004bc0ef82c927ada05ec6938d8 (diff) |
debugfs: avoid undefined bit shift in parse_uint()
The case is one that should never happen (and indicates a bug if it
does), but in that case, we should still avoid an undefiniced C
expression.
Fixes-Coverity-Bug: 1297494
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'debugfs')
-rw-r--r-- | debugfs/set_fields.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c index 117cfb81..65949060 100644 --- a/debugfs/set_fields.c +++ b/debugfs/set_fields.c @@ -495,7 +495,7 @@ static errcode_t parse_uint(struct field_set_info *info, char *field, } if (!field2) return 0; - n = num >> (size*8); + n = (size == 8) ? 0 : (num >> (size*8)); u.ptr8 = (__u8 *) field2; if (info->size == 6) size = 2; |