Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3848657pxb; Tue, 10 Nov 2020 01:21:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRMIaPONKoB8rBgqdGWm0CcABT7RGhNGRlWkjcK7RYYIT/juqLXnPtuedddBOG5cFt8XWK X-Received: by 2002:a50:d942:: with SMTP id u2mr20189903edj.202.1605000065130; Tue, 10 Nov 2020 01:21:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605000065; cv=none; d=google.com; s=arc-20160816; b=oInamBxNBnD+nyb7d49Cc0CIIwOjOBoVZfye3Q75txnJ2r/uTEddfxhXeyHr8U3CUW SNZ6j6A+fKJ5n3vatXAo7IbuYgkhihWHASMmZDJ+1cVIZ9Corz0T+lpX++uGy2GZoB5o yu775LkbnYapZ7f6/9l0FxtlZ5A/gdWAj1s5RWbHnHuvAJlXQxPZjRHE9TrCrjnQP4xF Da3uVM/3xa2PgGdCwWCJz5Q3iDza4+72Pp3Y5tpjieP6sEGfonD21yaJX7bjs8uA7ptO t4k+8Twmw9ucjyTk5Bj+BOrGQnBsk5I07yd9TClOfz9fhOzMWlnegf5CUdqGdGxguDx1 N96w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Km0VkN/aSnXbnC5yw6Pvj3HHWYvVfK1uTN4eOR5X4Qc=; b=dm6ZR2Ya7BOT9M9E1Uo9HAh5/Gp1FjuOtDj1cit/OSlq6jy2CAkQ3AIrL9k9vjaU/V L083flP8FHpwx+iu6M85yv0pXiwq6N08ElmgVvB2QTdz6eZK7vNUs0cKwQe5peYQ7qrX uaAL81ehw5MbVEbf0Fp9B23L3TyDqkTwoxG4X6znaHaSHBZ9EYwzljkRi0mcqaDwFBub pL9vPFUhchGhsGt4JznyJMjephkGNXUTElTqHRHZ/1boZCk4/nIrPakej2m7MYGZof2L /ZXUV4mtgvSBxn7MskU9UYtSGsTpoTA2feF0gkjk+OGqwjy8XDPZdsBNFsmVOOFYyvjf LaJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a27si8554561ejd.485.2020.11.10.01.20.42; Tue, 10 Nov 2020 01:21:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728966AbgKJJRr (ORCPT + 99 others); Tue, 10 Nov 2020 04:17:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:45068 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726213AbgKJJRq (ORCPT ); Tue, 10 Nov 2020 04:17:46 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E22B1AC24; Tue, 10 Nov 2020 09:17:44 +0000 (UTC) Subject: Re: [PATCH] drm/fb_helper: Use min_t() to handle size_t and unsigned long To: Geert Uytterhoeven , Maarten Lankhorst , Maxime Ripard , David Airlie , Daniel Vetter , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20201110090119.2667326-1-geert+renesas@glider.be> From: Thomas Zimmermann Message-ID: Date: Tue, 10 Nov 2020 10:17:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201110090119.2667326-1-geert+renesas@glider.be> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Am 10.11.20 um 10:01 schrieb Geert Uytterhoeven: > On arm32: > > drivers/gpu/drm/drm_fb_helper.c: In function ‘fb_read_screen_base’: > include/linux/minmax.h:18:28: warning: comparison of distinct pointer types lacks a cast > ... > drivers/gpu/drm/drm_fb_helper.c:2041:22: note: in expansion of macro ‘min’ > 2041 | size_t alloc_size = min(count, PAGE_SIZE); > | ^~~ > drivers/gpu/drm/drm_fb_helper.c: In function ‘fb_write_screen_base’: > include/linux/minmax.h:18:28: warning: comparison of distinct pointer types lacks a cast > ... > drivers/gpu/drm/drm_fb_helper.c:2115:22: note: in expansion of macro ‘min’ > 2115 | size_t alloc_size = min(count, PAGE_SIZE); > | ^~~ > > Indeed, on 32-bit size_t is "unsigned int", not "unsigned long". > > Fixes: 222ec45f4c69dfa8 ("drm/fb_helper: Support framebuffers in I/O memory") > Signed-off-by: Geert Uytterhoeven Reviewed-by: Thomas Zimmermann Thanks a lot. I'll add the patch to drm-misc-next. > --- > Interestingly, the commit log claims v7 changed: > > use min_t(size_t,) (kernel test robot) It got fixed in the functions' inner loops, but I missed the other instances. Best regards Thomas > --- > drivers/gpu/drm/drm_fb_helper.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 01ba1da285116373..25edf670867c6f79 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -2038,7 +2038,7 @@ static ssize_t fb_read_screen_base(struct fb_info *info, char __user *buf, size_ > loff_t pos) > { > const char __iomem *src = info->screen_base + pos; > - size_t alloc_size = min(count, PAGE_SIZE); > + size_t alloc_size = min_t(size_t, count, PAGE_SIZE); > ssize_t ret = 0; > int err = 0; > char *tmp; > @@ -2112,7 +2112,7 @@ static ssize_t fb_write_screen_base(struct fb_info *info, const char __user *buf > loff_t pos) > { > char __iomem *dst = info->screen_base + pos; > - size_t alloc_size = min(count, PAGE_SIZE); > + size_t alloc_size = min_t(size_t, count, PAGE_SIZE); > ssize_t ret = 0; > int err = 0; > u8 *tmp; > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer