Skip to content

Commit 4cc06c9

Browse files
mzaslonkakpm00
authored andcommitted
lib/zlib: adjust offset calculation for dfltcc_state
Patch series "lib/zlib: Set of s390 DFLTCC related patches for kernel zlib". Patches 1-7 represent a set of s390 zlib hardware support (DFLTCC) related fixes and enhancements integrated from zlib-ng repo relevant to kernel zlib (https://github.com/zlib-ng/zlib-ng). Since the official zlib repository never got DFLTCC support code merged, all the patches have been picked from zlib-ng fork (zlib data compression library for the next generation systems). This repo contains new optimizations and fixes not getting implemented into the official zlib repository and falls under the same zlib License. All of the original patches from zlib-ng were authored by Ilya Leoshkevich <[email protected]>. Coding style has been preserved for future maintainability. Patches 1-2 should have no effect for the kernel zlib but make the code closer to zlib-ng for future maintainability. Only Patch 3 touches common zlib_deflate code, other patches are relevant to s390 tree only. Patch 8 is separate and intends to resolve an issue with kernel PPP driver which can use kernel zlib for packet compression. Without this patch PPP decompression can fail due to error code returned by hardware (dfltcc_inflate) and PPP disables zlib compression for further packets. This patch (of 8): This commit is based on: zlib-ng/zlib-ng@d8b67f5 Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Mikhail Zaslonko <[email protected]> Acked-by: Ilya Leoshkevich <[email protected]> Cc: Heiko Carstens <[email protected]> (s390) Cc: Vasily Gorbik <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 5124a0a commit 4cc06c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/zlib_dfltcc/dfltcc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ struct dfltcc_state {
100100
char msg[64]; /* Buffer for strm->msg */
101101
};
102102

103+
#define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1))
103104
/* Resides right after inflate_state or deflate_state */
104-
#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((state) + 1))
105+
#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((char *)(state) + ALIGN_UP(sizeof(*state), 8)))
105106

106107
/* External functions */
107108
int dfltcc_can_deflate(z_streamp strm);

0 commit comments

Comments
 (0)