Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3839544pxb; Tue, 10 Nov 2020 01:03:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxeOqhPprPg4uvuKXzBUooyron9te8FS2qXwnG7wmYF6YYGFvPIQCJMId7YnoohjopHqq4 X-Received: by 2002:a50:f604:: with SMTP id c4mr7043515edn.117.1604999010733; Tue, 10 Nov 2020 01:03:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604999010; cv=none; d=google.com; s=arc-20160816; b=kmFmY/wTK6ARKStG0LJaFtEoT9QODf6dVWWgqr+DoYFqWkbddtu+ASOw+VALVK+lBl twLYJZjOrac5pqi3RfC/66H3ajcC/wrwKv3E2NkbYHMJi5Jg8msXTILhIxtSIH5w7MAb 0pTTGmVn0kwZRzJU568kIzOgGUocDEXnd6ivoCTKjqzrtP3G+7WK6wmF1q1lQqArwTnR V8bJGZsfzEPJvDXvKkk1kt3ViuToQmVZXXEmiUuL4F9mO8Qi3TabEyktPPWlispH954R Jdnq6GwAL+oPunebu5N/EAC+GikUY78LWlyQQimyuSK5MKQgFhpeNTF0EneAezXOSrdh oJEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=VpSDn5lbFavkBxOeNVVEHU/4xxs9dcBQblVNdK+hgJs=; b=yyd7li6J5VpaC1mxsZ0uIHnw8PfFCipGWWq43rwpTmnnmnfCbC1zFrbz1hLhEsnMa2 VE88mKiuVLTK3YYUJd/h/fQUJ/0X/CB5Dy4bRXHwaGhoUsOW3+4yseJoRaBjiULD6qlw kUsSsXGgxCK8YGio2pS7uD6Pug1bX2hUpWrLnjACJI0Q80O8VR3mWAq20PSIebSJ4PLV sPmZY7Fxzk7l+5d6hflp0uMDsbVTSicrR4r2x4ewp47g0ZinK5g1swmB5Lkzrcuja+Hk MP07jT6NeMqGIKIjM4CK+8hCingkEp4QVd2Rvji4Ee55Y8cJrOwZ8HHhltOsNbekIRmX lMFw== 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 d22si8293693ejr.471.2020.11.10.01.03.07; Tue, 10 Nov 2020 01:03:30 -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 S1729518AbgKJJBZ (ORCPT + 99 others); Tue, 10 Nov 2020 04:01:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgKJJBZ (ORCPT ); Tue, 10 Nov 2020 04:01:25 -0500 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFB71C0613CF for ; Tue, 10 Nov 2020 01:01:24 -0800 (PST) Received: from ramsan.of.borg ([84.195.186.194]) by xavier.telenet-ops.be with bizsmtp id qZ1M2300X4C55Sk01Z1Moc; Tue, 10 Nov 2020 10:01:22 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kcPWj-0016f1-HT; Tue, 10 Nov 2020 10:01:21 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1kcPWi-00BBu9-N3; Tue, 10 Nov 2020 10:01:20 +0100 From: Geert Uytterhoeven To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] drm/fb_helper: Use min_t() to handle size_t and unsigned long Date: Tue, 10 Nov 2020 10:01:19 +0100 Message-Id: <20201110090119.2667326-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Interestingly, the commit log claims v7 changed: use min_t(size_t,) (kernel test robot) --- 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; -- 2.25.1