Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1241289 > unrolled thread

[PATCH] intel_th: fix compile warning

Started byArnd Bergmann <arnd@arndb.de>
First post2015-10-07 11:30 +0200
Last post2015-10-07 11:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] intel_th: fix compile warning Arnd Bergmann <arnd@arndb.de> - 2015-10-07 11:30 +0200
    Re: [PATCH] intel_th: fix compile warning Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-10-07 11:50 +0200

#1241289 — [PATCH] intel_th: fix compile warning

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-07 11:30 +0200
Subject[PATCH] intel_th: fix compile warning
Message-ID<qgTcS-DX-43@gated-at.bofh.it>
The newly added MSU portion of the intel_th driver causes a harmless
compile warning on 32-bit kernels:

drivers/hwtracing/intel_th/msu.c: In function 'msc_single_to_user':
include/linux/kernel.h:724:17: warning: comparison of distinct pointer types lacks a cast

This changes the code to use min_t() to force the correct type and
avoid that warning, which seems easier than changing the code to
use consistent types everywhere.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index 99f7662e27f1..4c6688a64db3 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -1062,7 +1062,7 @@ msc_single_to_user(struct msc *msc, char __user *buf, loff_t off, size_t len)
 	if (msc->single_wrap) {
 		start += msc->single_sz;
 		if (start < size) {
-			tocopy = min(rem, size - start);
+			tocopy = min_t(size_t, rem, size - start);
 			if (copy_to_user(buf, msc->base + start, tocopy))
 				return -EFAULT;
 
@@ -1073,7 +1073,7 @@ msc_single_to_user(struct msc *msc, char __user *buf, loff_t off, size_t len)
 
 		start &= size - 1;
 		if (rem) {
-			tocopy = min(rem, msc->single_sz - start);
+			tocopy = min_t(size_t, rem, msc->single_sz - start);
 			if (copy_to_user(buf, msc->base + start, tocopy))
 				return -EFAULT;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1241303

FromAlexander Shishkin <alexander.shishkin@linux.intel.com>
Date2015-10-07 11:50 +0200
Message-ID<qgTwe-10x-19@gated-at.bofh.it>
In reply to#1241289
Arnd Bergmann <arnd@arndb.de> writes:

> The newly added MSU portion of the intel_th driver causes a harmless
> compile warning on 32-bit kernels:
>
> drivers/hwtracing/intel_th/msu.c: In function 'msc_single_to_user':
> include/linux/kernel.h:724:17: warning: comparison of distinct pointer types lacks a cast
>
> This changes the code to use min_t() to force the correct type and
> avoid that warning, which seems easier than changing the code to
> use consistent types everywhere.

This from yesterday:
http://marc.info/?l=linux-kernel&m=144412498425492

Regards,
--
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web