From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754324AbcIDSsE (ORCPT ); Sun, 4 Sep 2016 14:48:04 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:37338 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758AbcIDSsC (ORCPT ); Sun, 4 Sep 2016 14:48:02 -0400 Date: Sun, 04 Sep 2016 11:48:01 -0700 (PDT) Message-Id: <20160904.114801.938788018799814156.davem@davemloft.net> To: paul.burton@imgtec.com Cc: florian@openwrt.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: ti: cpmac: Fix compiler warning due to type confusion From: David Miller In-Reply-To: <20160902142248.3553-1-paul.burton@imgtec.com> References: <20160902142248.3553-1-paul.burton@imgtec.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 04 Sep 2016 11:48:01 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Burton Date: Fri, 2 Sep 2016 15:22:48 +0100 > cpmac_start_xmit() used the max() macro on skb->len (an unsigned int) > and ETH_ZLEN (a signed int literal). This led to the following compiler > warning: > > In file included from include/linux/list.h:8:0, > from include/linux/module.h:9, > from drivers/net/ethernet/ti/cpmac.c:19: > drivers/net/ethernet/ti/cpmac.c: In function 'cpmac_start_xmit': > include/linux/kernel.h:748:17: warning: comparison of distinct pointer > types lacks a cast > (void) (&_max1 == &_max2); \ > ^ > drivers/net/ethernet/ti/cpmac.c:560:8: note: in expansion of macro 'max' > len = max(skb->len, ETH_ZLEN); > ^ > > On top of this, it assigned the result of the max() macro to a signed > integer whilst all further uses of it result in it being cast to varying > widths of unsigned integer. > > Fix this up by using max_t to ensure the comparison is performed as > unsigned integers, and for consistency change the type of the len > variable to unsigned int. > > Signed-off-by: Paul Burton Applied.