mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-25 11:55:37 +00:00
Merge branch 'for-5.18-vsprintf-fourcc-fixup' into for-linus
This commit is contained in:
commit
0834c6f03b
1 changed files with 8 additions and 5 deletions
|
@ -49,6 +49,7 @@
|
||||||
|
|
||||||
#include <asm/page.h> /* for PAGE_SIZE */
|
#include <asm/page.h> /* for PAGE_SIZE */
|
||||||
#include <asm/byteorder.h> /* cpu_to_le16 */
|
#include <asm/byteorder.h> /* cpu_to_le16 */
|
||||||
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
#include <linux/string_helpers.h>
|
#include <linux/string_helpers.h>
|
||||||
#include "kstrtox.h"
|
#include "kstrtox.h"
|
||||||
|
@ -1788,7 +1789,7 @@ char *fourcc_string(char *buf, char *end, const u32 *fourcc,
|
||||||
char output[sizeof("0123 little-endian (0x01234567)")];
|
char output[sizeof("0123 little-endian (0x01234567)")];
|
||||||
char *p = output;
|
char *p = output;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
u32 val;
|
u32 orig, val;
|
||||||
|
|
||||||
if (fmt[1] != 'c' || fmt[2] != 'c')
|
if (fmt[1] != 'c' || fmt[2] != 'c')
|
||||||
return error_string(buf, end, "(%p4?)", spec);
|
return error_string(buf, end, "(%p4?)", spec);
|
||||||
|
@ -1796,21 +1797,23 @@ char *fourcc_string(char *buf, char *end, const u32 *fourcc,
|
||||||
if (check_pointer(&buf, end, fourcc, spec))
|
if (check_pointer(&buf, end, fourcc, spec))
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
val = *fourcc & ~BIT(31);
|
orig = get_unaligned(fourcc);
|
||||||
|
val = orig & ~BIT(31);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(*fourcc); i++) {
|
for (i = 0; i < sizeof(u32); i++) {
|
||||||
unsigned char c = val >> (i * 8);
|
unsigned char c = val >> (i * 8);
|
||||||
|
|
||||||
/* Print non-control ASCII characters as-is, dot otherwise */
|
/* Print non-control ASCII characters as-is, dot otherwise */
|
||||||
*p++ = isascii(c) && isprint(c) ? c : '.';
|
*p++ = isascii(c) && isprint(c) ? c : '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(p, *fourcc & BIT(31) ? " big-endian" : " little-endian");
|
*p++ = ' ';
|
||||||
|
strcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");
|
||||||
p += strlen(p);
|
p += strlen(p);
|
||||||
|
|
||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
*p++ = '(';
|
*p++ = '(';
|
||||||
p = special_hex_number(p, output + sizeof(output) - 2, *fourcc, sizeof(u32));
|
p = special_hex_number(p, output + sizeof(output) - 2, orig, sizeof(u32));
|
||||||
*p++ = ')';
|
*p++ = ')';
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue