The patch titled Subject: zstd: change structure variable from int to char has been added to the -mm tree. Its filename is zstd-change-structure-variable-from-int-to-char.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/zstd-change-structure-variable-from-int-to-char.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/zstd-change-structure-variable-from-int-to-char.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Maninder Singh <maninder1.s@xxxxxxxxxxx> Subject: zstd: change structure variable from int to char Elements of ZSTD_frameParameters structure are used as flags, so just declare them as char. ZSTD_frameParameters structure is used by ZSTD_parameters. Before: ====== sizeof(ZSTD_parameters) $1 = 40 After: ===== sizeof(ZSTD_parameters) $1 = 32 Link: http://lkml.kernel.org/r/1559552526-4317-5-git-send-email-maninder1.s@xxxxxxxxxxx Signed-off-by: Maninder Singh <maninder1.s@xxxxxxxxxxx> Signed-off-by: Vaneet Narang <v.narang@xxxxxxxxxxx> Cc: Amit Sahrawat <a.sahrawat@xxxxxxxxxxx> Cc: David S. Miller <davem@xxxxxxxxxxxxx> Cc: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx> Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Cc: Joe Perches <joe@xxxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Cc: <pankaj.m@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/zstd.h | 6 +++--- lib/zstd/compress.c | 4 ++-- lib/zstd/decompress.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) --- a/include/linux/zstd.h~zstd-change-structure-variable-from-int-to-char +++ a/include/linux/zstd.h @@ -164,9 +164,9 @@ typedef struct { * The default value is all fields set to 0. */ typedef struct { - unsigned int contentSizeFlag; - unsigned int checksumFlag; - unsigned int noDictIDFlag; + unsigned char contentSizeFlag; + unsigned char checksumFlag; + unsigned char noDictIDFlag; } ZSTD_frameParameters; /** --- a/lib/zstd/compress.c~zstd-change-structure-variable-from-int-to-char +++ a/lib/zstd/compress.c @@ -2435,9 +2435,9 @@ static size_t ZSTD_writeFrameHeader(void { BYTE *const op = (BYTE *)dst; U32 const dictIDSizeCode = (dictID > 0) + (dictID >= 256) + (dictID >= 65536); /* 0-3 */ - U32 const checksumFlag = params->fParams.checksumFlag > 0; + BYTE const checksumFlag = params->fParams.checksumFlag > 0; U32 const windowSize = 1U << params->cParams.windowLog; - U32 const singleSegment = params->fParams.contentSizeFlag && (windowSize >= pledgedSrcSize); + BYTE const singleSegment = params->fParams.contentSizeFlag && (windowSize >= pledgedSrcSize); BYTE const windowLogByte = (BYTE)((params->cParams.windowLog - ZSTD_WINDOWLOG_ABSOLUTEMIN) << 3); U32 const fcsCode = params->fParams.contentSizeFlag ? (pledgedSrcSize >= 256) + (pledgedSrcSize >= 65536 + 256) + (pledgedSrcSize >= 0xFFFFFFFFU) : 0; /* 0-3 */ --- a/lib/zstd/decompress.c~zstd-change-structure-variable-from-int-to-char +++ a/lib/zstd/decompress.c @@ -233,7 +233,7 @@ size_t ZSTD_getFrameParams(ZSTD_framePar BYTE const fhdByte = ip[4]; size_t pos = 5; U32 const dictIDSizeCode = fhdByte & 3; - U32 const checksumFlag = (fhdByte >> 2) & 1; + BYTE const checksumFlag = (fhdByte >> 2) & 1; U32 const singleSegment = (fhdByte >> 5) & 1; U32 const fcsID = fhdByte >> 6; U32 const windowSizeMax = 1U << ZSTD_WINDOWLOG_MAX; _ Patches currently in -mm which might be from maninder1.s@xxxxxxxxxxx are zstd-pass-pointer-rathen-than-structure-to-functions.patch zstd-use-u16-data-type-for-rankpos.patch zstd-move-params-structure-to-global-variable-to-reduce-stack-usage.patch zstd-change-structure-variable-from-int-to-char.patch