]> granicus.if.org Git - strace/commitdiff
Fix printing of invalid struct ubi_mkvol_req.vol_type
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 16 May 2016 22:25:46 +0000 (22:25 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 16 May 2016 22:41:20 +0000 (22:41 +0000)
* mtd.c (ubi_ioctl): Explicitly cast struct ubi_mkvol_req.vol_type
to unsigned short to avoid potential sign-extension bug when printing
invalid struct ubi_mkvol_req.vol_type.

mtd.c

diff --git a/mtd.c b/mtd.c
index 25025367c00e6bf78663d0e09f1312d15d887e15..208858d31c149c8ce8909b64fb2f8be66f62e8ce 100644 (file)
--- a/mtd.c
+++ b/mtd.c
@@ -353,7 +353,8 @@ ubi_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
                        tprintf("{vol_id=%" PRIi32 ", alignment=%" PRIi32
                                ", bytes=%" PRIi64 ", vol_type=", mkvol.vol_id,
                                mkvol.alignment, (int64_t)mkvol.bytes);
-                       printxval(ubi_volume_types, mkvol.vol_type, "UBI_???_VOLUME");
+                       printxval(ubi_volume_types,
+                                   (uint8_t) mkvol.vol_type, "UBI_???_VOLUME");
                        tprintf(", name_len=%" PRIi16 ", name=", mkvol.name_len);
                        if (print_quoted_string(mkvol.name,
                                        CLAMP(mkvol.name_len, 0, UBI_MAX_VOLUME_NAME),