|
|
a77133 |
From c78e3e170a63bb1804b47d4f5a6652aad0e4d3b2 Mon Sep 17 00:00:00 2001
|
|
|
a77133 |
From: Theodore Ts'o <tytso@mit.edu>
|
|
|
a77133 |
Date: Tue, 6 Oct 2020 08:29:09 -0400
|
|
|
a77133 |
Subject: [PATCH 12/46] debugfs: fix parse_uint for 64-bit fields
|
|
|
a77133 |
Content-Type: text/plain
|
|
|
a77133 |
|
|
|
a77133 |
The logic for handling 64-bit structure elements was reversed, which
|
|
|
a77133 |
caused attempts to set fields like kbytes_written to fail:
|
|
|
a77133 |
|
|
|
a77133 |
% debugfs -w /tmp/foo.img
|
|
|
a77133 |
debugfs 1.45.6 (20-Mar-2020)
|
|
|
a77133 |
debugfs: set_super_value kbytes_written 1024
|
|
|
a77133 |
64-bit field kbytes_written has a second 64-bit field
|
|
|
a77133 |
defined; BUG?!?
|
|
|
a77133 |
|
|
|
a77133 |
https://github.com/tytso/e2fsprogs/issues/36
|
|
|
a77133 |
|
|
|
a77133 |
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
|
|
a77133 |
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
|
|
|
a77133 |
---
|
|
|
a77133 |
debugfs/set_fields.c | 10 +++++-----
|
|
|
a77133 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
a77133 |
|
|
|
a77133 |
diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c
|
|
|
a77133 |
index 5142554d..281f2c5d 100644
|
|
|
a77133 |
--- a/debugfs/set_fields.c
|
|
|
a77133 |
+++ b/debugfs/set_fields.c
|
|
|
a77133 |
@@ -487,10 +487,7 @@ static errcode_t parse_uint(struct field_set_info *info, char *field,
|
|
|
a77133 |
n = num & mask;
|
|
|
a77133 |
switch (size) {
|
|
|
a77133 |
case 8:
|
|
|
a77133 |
- /* Should never get here */
|
|
|
a77133 |
- fprintf(stderr, "64-bit field %s has a second 64-bit field\n"
|
|
|
a77133 |
- "defined; BUG?!?\n", info->name);
|
|
|
a77133 |
- *u.ptr64 = 0;
|
|
|
a77133 |
+ *u.ptr64 = n;
|
|
|
a77133 |
break;
|
|
|
a77133 |
case 4:
|
|
|
a77133 |
*u.ptr32 = n;
|
|
|
a77133 |
@@ -510,7 +507,10 @@ static errcode_t parse_uint(struct field_set_info *info, char *field,
|
|
|
a77133 |
size = 2;
|
|
|
a77133 |
switch (size) {
|
|
|
a77133 |
case 8:
|
|
|
a77133 |
- *u.ptr64 = n;
|
|
|
a77133 |
+ /* Should never get here */
|
|
|
a77133 |
+ fprintf(stderr, "64-bit field %s has a second 64-bit field\n"
|
|
|
a77133 |
+ "defined; BUG?!?\n", info->name);
|
|
|
a77133 |
+ *u.ptr64 = 0;
|
|
|
a77133 |
break;
|
|
|
a77133 |
case 4:
|
|
|
a77133 |
*u.ptr32 = n;
|
|
|
a77133 |
--
|
|
|
a77133 |
2.35.1
|
|
|
a77133 |
|