public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de
Subject: [PATCH] lz4: Fix compile warning comparison of distinct pointer types
Date: Wed, 27 Jul 2022 17:24:23 +0200	[thread overview]
Message-ID: <20220727152423.26792-1-pali@kernel.org> (raw)

In file included from include/linux/bitops.h:22,
                 from include/log.h:15,
                 from include/linux/printk.h:4,
                 from include/common.h:20,
                 from lib/lz4_wrapper.c:6:
lib/lz4_wrapper.c: In function ‘ulz4fn’:
include/linux/kernel.h:184:17: warning: comparison of distinct pointer types lacks a cast
  (void) (&_min1 == &_min2);  \
                 ^~
lib/lz4_wrapper.c:104:18: note: in expansion of macro ‘min’
    size_t size = min((ptrdiff_t)block_size, end - out);
                  ^~~

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 lib/lz4_wrapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/lz4_wrapper.c b/lib/lz4_wrapper.c
index ebcb5c09a22c..5f8f5af012cf 100644
--- a/lib/lz4_wrapper.c
+++ b/lib/lz4_wrapper.c
@@ -101,7 +101,7 @@ int ulz4fn(const void *src, size_t srcn, void *dst, size_t *dstn)
 		}
 
 		if (block_header & LZ4F_BLOCKUNCOMPRESSED_FLAG) {
-			size_t size = min((ptrdiff_t)block_size, end - out);
+			size_t size = min((ptrdiff_t)block_size, (ptrdiff_t)(end - out));
 			memcpy(out, in, size);
 			out += size;
 			if (size < block_size) {
-- 
2.20.1


             reply	other threads:[~2022-07-27 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 15:24 Pali Rohár [this message]
2022-08-10 21:50 ` [PATCH] lz4: Fix compile warning comparison of distinct pointer types Tom Rini

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=20220727152423.26792-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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