From: Sameer Vaze <svaze@qti.qualcomm.com>
To: Sunila Sahu <ssahu@marvell.com>,
Fan Zhang <fanzhang.oss@gmail.com>,
Ashish Gupta <ashishg@marvell.com>
Cc: dev@dpdk.org, Sameer Vaze <svaze@qti.qualcomm.com>, stable@dpdk.org
Subject: [PATCH v1] compress/zlib: fix UDC checksum logic
Date: Tue, 16 Dec 2025 12:36:16 -0700 [thread overview]
Message-ID: <20251216193616.373430-1-svaze@qti.qualcomm.com> (raw)
Fixes bugs with casting and checksum calculation for
UDC checksum
Fixes: 0dc314debb22 ("compress/zlib: support dictionaries and PDCP checksum")
Cc: stable@dpdk.org
Signed-off-by: Sameer Vaze <svaze@qti.qualcomm.com>
---
drivers/compress/zlib/zlib_pmd.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/compress/zlib/zlib_pmd.c b/drivers/compress/zlib/zlib_pmd.c
index 1d7651dd7d..bb970912cb 100644
--- a/drivers/compress/zlib/zlib_pmd.c
+++ b/drivers/compress/zlib/zlib_pmd.c
@@ -48,12 +48,12 @@ process_zlib_deflate_chksum(struct rte_comp_op *op,
return;
}
- dictionary_start = (uint32_t)(*dictionary);
- dictionary_end = (uint32_t)(*(dictionary + dictionary_len - 4));
+ dictionary_start = *(uint32_t *)dictionary;
+ dictionary_end = *(uint32_t *)(dictionary + dictionary_len - 4);
sum = (dictionary_start & BOTTOM_NIBBLE_OF_BYTES_IN_DOUBLE_WORD)
- + (dictionary_start & (TOP_NIBBLE_OF_BYTE_IN_DOUBLE_WORD >> 4))
+ + ((dictionary_start & TOP_NIBBLE_OF_BYTE_IN_DOUBLE_WORD) >> 4)
+ (dictionary_end & BOTTOM_NIBBLE_OF_BYTES_IN_DOUBLE_WORD)
- + (dictionary_end & (TOP_NIBBLE_OF_BYTE_IN_DOUBLE_WORD >> 4));
+ + ((dictionary_end & TOP_NIBBLE_OF_BYTE_IN_DOUBLE_WORD) >> 4);
op->output_chksum = ~(sum_bytes[0] + sum_bytes[1] + sum_bytes[2] + sum_bytes[3])
& BOTTOM_NIBBLE_OF_BYTE;
@@ -98,12 +98,12 @@ process_zlib_inflate_chksum(struct rte_comp_op *op,
return;
}
- dictionary_start = (uint32_t)(*dictionary);
- dictionary_end = (uint32_t)(*(dictionary + dictionary_len - 4));
+ dictionary_start = *(uint32_t *)dictionary;
+ dictionary_end = *(uint32_t *)(dictionary + dictionary_len - 4);
sum = (dictionary_start & BOTTOM_NIBBLE_OF_BYTES_IN_DOUBLE_WORD)
- + (dictionary_start & (TOP_NIBBLE_OF_BYTE_IN_DOUBLE_WORD >> 4))
+ + ((dictionary_start & TOP_NIBBLE_OF_BYTE_IN_DOUBLE_WORD) >> 4)
+ (dictionary_end & BOTTOM_NIBBLE_OF_BYTES_IN_DOUBLE_WORD)
- + (dictionary_end & (TOP_NIBBLE_OF_BYTE_IN_DOUBLE_WORD >> 4));
+ + ((dictionary_end & TOP_NIBBLE_OF_BYTE_IN_DOUBLE_WORD) >> 4);
op->output_chksum = ~(sum_bytes[0] + sum_bytes[1] + sum_bytes[2] + sum_bytes[3])
& BOTTOM_NIBBLE_OF_BYTE;
--
2.31.1
reply other threads:[~2025-12-16 19:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251216193616.373430-1-svaze@qti.qualcomm.com \
--to=svaze@qti.qualcomm.com \
--cc=ashishg@marvell.com \
--cc=dev@dpdk.org \
--cc=fanzhang.oss@gmail.com \
--cc=ssahu@marvell.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).