Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2865502ybi; Sun, 26 May 2019 09:20:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQHdnQANxt1zkuXjT7VyCb2o+6ys/PYaKhn4ANIEMrqiC665yILAibPyB9Ao5cz/cA2W4S X-Received: by 2002:a65:60cd:: with SMTP id r13mr106325476pgv.58.1558887648815; Sun, 26 May 2019 09:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558887648; cv=none; d=google.com; s=arc-20160816; b=CymGTAhA4WuP5iArBTE0hW/95QN23ROdUwqHwTTDQJRTNky5IYcrv/zLIy5qvEhMw9 xslSblAVs7S66Wn8mFdE6R/e2yfArIDMZBFRFvTMXyGrzozk0eMlhEuP7gQCAllb4M01 f7pD07++sG8eyZkemCMB5VyeyrzLO6g/VgSKkCycwugH/Eutudf+TMfIQxj432XOhg2J 8HA0zoM/lCN3h02Lr/oHIN0Ken0cvrBJWATPhurqByq9lcyqY6z26k8SKuNcDRD8YSqe SHgbOxokwEcHdTjgrbNA0c9pxOuqp7zzlMHmGFw2ZvE3L4dfER13uByD8v6d6hiea53+ FxxA== 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=T+Mawwo8dbExPe1NlhGh5Bdm0Ad60nu3jrGl8X5WPJ0=; b=SFP1O414IyZavTZMM+SPXMl5A2r95qOg6qfIONd0huAEoqryKPsVwr3vZJnSNQWb5R pLzuLM2y5euMieMwHO2z1WNAAxS+4YgAwS+jhJ6Aze4GW3mQ6KHZVOl8tI3RczKDIigW 82fyOJmT887j6E/NcArmuQBoagNOlMyG5PARqZd8BbCZCaAeHGKZ5KOBEghtWco3aWas ELKkpgjuO5xAifuKnBy6IQuVgqXnx1F1EimIDBhVl9TbsjGCKRgCBhvY98woXemT7wO5 z4SvnhMeEoejwKIcTjuUuRmxvu8wtDs00DZ+VBkcpADxm6I3mIdT89I3qeaClS9jKGO2 V2ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VXFsLaIa; 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 z5si14910109plh.219.2019.05.26.09.20.32; Sun, 26 May 2019 09:20:48 -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=VXFsLaIa; 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 S1727884AbfEZQF1 (ORCPT + 99 others); Sun, 26 May 2019 12:05:27 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37750 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726759AbfEZQF0 (ORCPT ); Sun, 26 May 2019 12:05:26 -0400 Received: by mail-pl1-f193.google.com with SMTP id p15so6065259pll.4 for ; Sun, 26 May 2019 09:05:26 -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=T+Mawwo8dbExPe1NlhGh5Bdm0Ad60nu3jrGl8X5WPJ0=; b=VXFsLaIa7EYxnHazNCjxhigloJgxfdWS1DKn8IeifcHtyLp72pGDS0aAIuMGoOLXRJ TFyRAuGYRjr0C41tHH3+rezHo2BkDg8S2kMbYM00NRATYQmKg8JutK1XGRtiXDA4P/65 lVX0Xto1g0VAf14C2rvDPoJ+svg71eNJr+SVqZk9ambFofpHf3vlgW503KiRbmiCHbCr TP1HCmrDUXSVHLPG8YOXrMbhs3Wpw8YHhafNrevR3kLYch6/w/iNfmlZufGIAGdGENsu Z86aRqFwff2YiiSg+ggQzizTGUEg5bLtEjwDdCDV5cEtPwILSnZH9PJhrKLUURaTGopf YVXA== 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=T+Mawwo8dbExPe1NlhGh5Bdm0Ad60nu3jrGl8X5WPJ0=; b=IL817cdjcIDdyuYGPRsu4gPqrrehKddcmy6qU6Y49HJ6y6VkPCKYsp0meCU5ervyL2 PyyzGcCV/SN0Q/aZzGc8+Rfl1Juyzl8YiwfvYFuQhQaSAs2t/u7AA7TPwTeWJfSjFMmw YqXK28y64WWNWr4Uct9yGG3IOUIfvT6ge5hP4xHK36q2sgVS0bVmBya5RWmCpe45Q/un Eqjbz/EssCHLU4sYARQ0kFtRy1N8kFzrIzah075MRC5bdlCot+tITRnBZZ+IhZ+n32E6 mC2GUCSjtdkiyPER0w+mpQYLhgqm2/CcQp3ZM4MkQlD3NK+mxP0hnvZxKH0zSALPa9kr zT6w== X-Gm-Message-State: APjAAAUHO/lYgotCvaHCim2xoDtgr3e3xXy823xEVFvkwxOcB0fk+zP4 mB1fUc5UAjn3NDX6+YhjyCAysoYg X-Received: by 2002:a17:902:b18c:: with SMTP id s12mr101967606plr.181.1558886726098; Sun, 26 May 2019 09:05:26 -0700 (PDT) Received: from jordon-HP-15-Notebook-PC.domain.name ([106.51.23.119]) by smtp.gmail.com with ESMTPSA id h60sm8716246pjb.10.2019.05.26.09.05.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 May 2019 09:05:24 -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: Sun, 26 May 2019 21:40:27 +0530 Message-Id: <1558887028-4026-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 values of length and vm_pgoff are ignored and this driver goes 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 --- v2: Fixed minor typo. 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