Hi Yulong,
On Fri, Mar 1, 2024 at 5:46 PM Tang Yulong <1637403063(a)qq.com> wrote:
OK, I have made the modifications as per your suggestions. Should I proceed with
resubmitting the patch? And how should I acknowledge your contribution? I'm not quite
clear on that for the first submission. Thank you for your guidance.
Please merge the following patch with your original patch(let's say
patch v1), and we will get an updated patch (let's say patch v2). So
you can post your v2 patch directly upstream like what you did for v1.
If there is no problem then I will ack it. The other
maintainers/developers will also review your v2 patch and may give ack
or comments to it.
Please have no worries about submitting patches. You can also add
Reviewed-by: Tao Liu <ltao(a)redhat.com>
after your signed-off-by signature if you like.
Thanks,
Yulong
diff --git a/lzorle_decompress.c b/lzorle_decompress.c
index bd7ee3f..5e83430 100644
--- a/lzorle_decompress.c
+++ b/lzorle_decompress.c
@@ -20,6 +20,8 @@
#include <stdint.h>
#include <string.h>
+#include "defs.h"
+
/* This MAX_255_COUNT is the maximum number of times we can add 255 to a base
* count without overflowing an integer. The multiply will overflow when
* multiplying 255 by more than MAXINT/255. The sum will overflow earlier
@@ -91,7 +93,28 @@ int lzorle_decompress_safe(const unsigned char *in, unsigned long
in_len,
}
t += 3;
copy_literal_run:
- {
+ if
(get_kernel_config("CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS", NULL) ==
IKCONFIG_Y) {
+ if (HAVE_IP(t + 15) && HAVE_OP(t + 15))
{
+ const unsigned char *ie = ip + t;
+ unsigned char *oe = op + t;
+ do {
+ COPY8(op, ip);
+ op += 8;
+ ip += 8;
+ COPY8(op, ip);
+ op += 8;
+ ip += 8;
+ } while (ip < ie);
+ ip = ie;
+ op = oe;
+ } else {
+ NEED_OP(t);
+ NEED_IP(t + 3);
+ do {
+ *op++ = *ip++;
+ } while (--t > 0);
+ }
+ } else {
NEED_OP(t);
NEED_IP(t + 3);
do {
@@ -194,7 +217,45 @@ copy_literal_run:
}
}
TEST_LB(m_pos);
- {
+
+ if (get_kernel_config("CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS",
NULL) == IKCONFIG_Y) {
+ if (op - m_pos >= 8) {
+ unsigned char *oe = op + t;
+ if (HAVE_OP(t + 15)) {
+ do {
+ COPY8(op, m_pos);
+ op += 8;
+ m_pos += 8;
+ COPY8(op, m_pos);
+ op += 8;
+ m_pos += 8;
+ } while (op < oe);
+ op = oe;
+ if (HAVE_IP(6)) {
+ state = next;
+ COPY4(op, ip);
+ op += next;
+ ip += next;
+ continue;
+ }
+ } else {
+ NEED_OP(t);
+ do {
+ *op++ = *m_pos++;
+ } while (op < oe);
+ }
+ } else {
+ unsigned char *oe = op + t;
+ NEED_OP(t);
+ op[0] = m_pos[0];
+ op[1] = m_pos[1];
+ op += 2;
+ m_pos += 2;
+ do {
+ *op++ = *m_pos++;
+ } while (op < oe);
+ }
+ } else {
unsigned char *oe = op + t;
NEED_OP(t);
op[0] = m_pos[0];
@@ -208,7 +269,20 @@ copy_literal_run:
match_next:
state = next;
t = next;
- {
+ if (get_kernel_config("CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS",
NULL) == IKCONFIG_Y) {
+ if (HAVE_IP(6) && HAVE_OP(4)) {
+ COPY4(op, ip);
+ op += t;
+ ip += t;
+ } else {
+ NEED_IP(t + 3);
+ NEED_OP(t);
+ while (t > 0) {
+ *op++ = *ip++;
+ t--;
+ }
+ }
+ } else {
NEED_IP(t + 3);
NEED_OP(t);
while (t > 0) {
--
Since I didn't successfully set up the test environment, please also
have a test on your v2 patch, to see if it really works as expected.
In addition, there are 3 identical
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS checks within the code, can you
shrink it so we only run the check one time?
Thanks,
Tao Liu
Crash-utility mailing list -- devel(a)lists.crash-utility.osci.io
To unsubscribe send an email to devel-leave(a)lists.crash-utility.osci.io
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines:
https://github.com/crash-utility/crash/wiki