From: Theodore Ts'o Date: Mon, 28 Jan 2013 14:02:23 +0000 (-0500) Subject: debugfs: add sanity check to make sure we never shift 64 bits right X-Git-Tag: v1.42.8~41 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7c1384c3242a7ff4e60d40e674077c0c5b124a4d;p=tools%2Fe2fsprogs.git debugfs: add sanity check to make sure we never shift 64 bits right In the tables which are used to parse the fields for the set_fields command, there should never be a entry which has a size set to 8 bytes, and two pointers defined. Not only would it result in undefined behavior in the compiled code, it doesn't make any sense and is definitely a bug. Reported-by: Xi Wang Signed-off-by: "Theodore Ts'o" --- diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c index 08bfd8d..5c86d74 100644 --- a/debugfs/set_fields.c +++ b/debugfs/set_fields.c @@ -389,7 +389,10 @@ static errcode_t parse_uint(struct field_set_info *info, char *field, n = num & mask; switch (size) { case 8: - *u.ptr64 = n; + /* Should never get here */ + fprintf(stderr, "64-bit field %s has a second 64-bit field\n" + "defined; BUG?!?\n", info->name); + *u.ptr64 = 0; break; case 4: *u.ptr32 = n;