Received: by 2002:a17:90a:2044:0:0:0:0 with SMTP id n62csp526051pjc; Mon, 20 May 2019 11:15:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwocaY9/szpVnftOQqNGdsgScmgNP+Ul3P65clKmRBOIE/CPQC4FlE4VzC/b9xrRZ2bU1oO X-Received: by 2002:a17:902:2884:: with SMTP id f4mr49186910plb.230.1558376131705; Mon, 20 May 2019 11:15:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558376131; cv=none; d=google.com; s=arc-20160816; b=qDHo44UVvhjGhG+vEegdxnCwK4kECRFov0BBkAH0C3Jv7ndQ57RQFZf2Au0oaIqahh E139pRVRy+y/yHrqqs5t7HIteHx3mqAzujb0RFC/N09iSGEjY33MR3CR0L6YFy7tkgJh yM463JoT0WX1xmkq5W4QWO3MxmV57PV0Sc8NmHC+u6IY3V7/6P6SSw08TN/7nHTo8LXc rODYUk98jV/TFvuNOYgaGWSJ4ukm0k5TO8no6fCyab0P1cNfdCdYnTkLRSPg2pF9aUsM IvTkRjXgbFjDKQD34to0u+OEyTsEWO149xVCn+xaL6SHfLcWlLo2QwE6Coo6jbJ6iaoi QU8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=uk849dcKmoqtNYZ7eIsEjVmGVspH3FFqGVpKFEH8i9o=; b=GbOztvoQ/4Pf3spyAeRw7x0YnyjCS1TlewZChT9WWQEiZvG40MCVPjZtasdIJkyc6v wo50qKDURyWQRoBj3l9Sp8pu0scpHL/XuHdJ8ad97bCww+eCXdXHgYwTdBKjcpFjjXEK 6mR7uhY0Eoga5V+CCtk/cOEH/8t6Dtmxf7JUtu7deaV53UJswf1FcWLZF8ILOBA+ema3 Hug51dMMf/+P8OkMh66fOzr9/Y25oWp1ekueGDJ+N701DYJexuBSeD3LeDIFDdKXLlOf SXRVYrFkTXQ5f4aUj+D5/VRZTBMYdyAwSXfINPOrJDZQcBHAgDLVSkJzRrncS9PrvDYH zHDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZZ8qMKt2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si18342074pgk.431.2019.05.20.11.15.16; Mon, 20 May 2019 11:15:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZZ8qMKt2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391968AbfETPYw (ORCPT + 99 others); Mon, 20 May 2019 11:24:52 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40586 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387783AbfETPYw (ORCPT ); Mon, 20 May 2019 11:24:52 -0400 Received: by mail-pf1-f193.google.com with SMTP id u17so7393073pfn.7 for ; Mon, 20 May 2019 08:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=uk849dcKmoqtNYZ7eIsEjVmGVspH3FFqGVpKFEH8i9o=; b=ZZ8qMKt246wsD17eM1gv1+70aRKyqr1s8GR/CGTaqJyuEgSqrj3cRHAfkywZzXGN3w pZfZrQ+kKUdjiI2RK8SpGtGITR3IjdgF0JwqClwVAtoCz5KiySr9Q3LwokSPXZ6y7RlA e4htp38Cnz/o6UGAabOHWqUnV7pwCTyjSoseSq2YBoJ5XWo2bCOLhrRPldyxbGXrbE8P EQjj0yl9NFx8eZI4M3WU7KdVhr9XcN6S+t55Rvn71AXom5U3qBg4OCHmU17j2XTi+oYV YRhgZq69dy+LR/lCBUqiJzZZkvg3dUz2jrtopy4txrbgJmQS1CyeXCF8zPsCu6gX2LxH EiRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uk849dcKmoqtNYZ7eIsEjVmGVspH3FFqGVpKFEH8i9o=; b=k9FldQUj6eursbf6uDt6pzLJ8f0n7Uyzyy3O2K10AYAYxdno9Xxnj69F/b5a4pf0k+ G5sXakKt1xiY5Iz5bUL3Zl9my3IqV8YWKsIZk1UEdfJV4xGPlykec3BAZ7dkAryJsn7X Awv06V/Av0TFKw/MEpUkrVRPXu5bNYfWJLbnR/WfokbmcGtZs6ysUyQL1dy7sFWlRSS5 uycv2j1JRBn6iIRFE/WMekaORi/efKXJG2tqOxeOY8rWSC54tOBKONWs7WmEEBsU2q/Y 8Y8Y62jiyNmSKdKtb0euFTCBZKnA0MEMMagCW3rok+HhFUCESgpU7blvK7vfUr0KRjpn eS0g== X-Gm-Message-State: APjAAAU3wn8Jb9z2yd3Dj76sKCZ3uOtmT/OiXtpmFFT0IeCHzpLtddtv WSXAR5qrIeSKBZ4UeftzYNc= X-Received: by 2002:a65:6145:: with SMTP id o5mr76017985pgv.262.1558365891426; Mon, 20 May 2019 08:24:51 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC.domain.name ([106.51.19.216]) by smtp.gmail.com with ESMTPSA id h13sm21522895pfo.98.2019.05.20.08.24.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 May 2019 08:24:50 -0700 (PDT) From: Souptick Joarder To: miguel.ojeda.sandonis@gmail.com Cc: linux-kernel@vger.kernel.org, willy@infradead.org, Souptick Joarder Subject: [PATCH 1/2] auxdisplay/cfag12864bfb.c: Convert to use vm_map_pages_zero() Date: Mon, 20 May 2019 20:58:56 +0530 Message-Id: <1558366136-3765-1-git-send-email-jrdr.linux@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While using mmap, the incorrect value of length and vm_pgoff are ignored and this driver go ahead with mapping cfag12864b_buffer to user vma. Convert vm_insert_pages() to use vm_map_pages_zero(). We could later "fix" these drivers to behave according to the normal vm_pgoff offsetting simply by removing the _zero suffix on the function name and if that causes regressions, it gives us an easy way to revert. Signed-off-by: Souptick Joarder --- drivers/auxdisplay/cfag12864bfb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/auxdisplay/cfag12864bfb.c b/drivers/auxdisplay/cfag12864bfb.c index 40c8a55..4074886 100644 --- a/drivers/auxdisplay/cfag12864bfb.c +++ b/drivers/auxdisplay/cfag12864bfb.c @@ -52,8 +52,9 @@ static int cfag12864bfb_mmap(struct fb_info *info, struct vm_area_struct *vma) { - return vm_insert_page(vma, vma->vm_start, - virt_to_page(cfag12864b_buffer)); + struct page *pages = virt_to_page(cfag12864b_buffer); + + return vm_map_pages_zero(vma, &pages, 1); } static struct fb_ops cfag12864bfb_ops = { -- 1.9.1