Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp740122pxa; Thu, 27 Aug 2020 14:38:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO7f347UprixvdLU5TQUe7j1OAs7NP3qTYGT1msdJrbsE+et0paNYp3yhH9Lkm8rMN0j5x X-Received: by 2002:a17:906:57d9:: with SMTP id u25mr21882556ejr.543.1598564291490; Thu, 27 Aug 2020 14:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598564291; cv=none; d=google.com; s=arc-20160816; b=sDTEUpMZEIu1w30iqmKcY+mB6kOpzGxP7b1GiJfo5CZpMmUPwTj1DeilO5F15eq3FT 7NStwkjc1qA86A+7CKC5+o9FIJ5KkXJiiNIiNrqLxx5qhQutVZVQoj8Oy39attnbTZ0w h6qRoDm0722FRwlSET1i+S8KknoImemGlBs2Dv1QUm0fKocC1wRDgNqJqtFfU/zCxPFE apl6PJDep8K1lu/dcJbJgu4mGKZOOYfJC1nag6dzg3sfHnDx+bODe7vmEGAUf5Y6kBma wZFBT73D0uwe1BXm32HVGIlHt9HlKe8gGMkEhlQ9iYXAUdfvBJjPgsSN+M4m5XL2TVjV g+Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=yeLFXCCaY4tDSM1nVOReyn/vTDxc9izwnURREpocfMs=; b=QL8CTvQhOXHAPZ/ny23425X9iSItG1txi6ZMg4eYEKbRMdJjytqnb+N5cbwbvT0L5A iMJlvQNdeGatRkSyk1Iqr55l+TqWBL7XUECUhtJL/rxbGDdIcf5NCgTGSsCKYn14H9b2 F0ORFwaUZvw5sMpM62qn6NV5asBnswgP9+nJncNjnZ9Cbim+EzTbj5RDEri5ih8q2MpK M7BN9/pKY+PJcic90qSwevfcPl5RuyRYnT8GYsUjHy02ODe3YLpHueQ042HmcuW4hV+4 igXG8ivwLKnkv6xlwAIZybMwRRJQrBrneSLSRClm/IW/zWdv5Ao4KTVhZj06ww2xfr8K V4Aw== 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 p14si2237710ejr.19.2020.08.27.14.37.49; Thu, 27 Aug 2020 14:38:11 -0700 (PDT) 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 S1727069AbgH0Veh (ORCPT + 99 others); Thu, 27 Aug 2020 17:34:37 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37545 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726243AbgH0Veh (ORCPT ); Thu, 27 Aug 2020 17:34:37 -0400 Received: by mail-lj1-f195.google.com with SMTP id w14so8118183ljj.4 for ; Thu, 27 Aug 2020 14:34:35 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=yeLFXCCaY4tDSM1nVOReyn/vTDxc9izwnURREpocfMs=; b=SggvQfOGWYb5fuogIPFsdAz+O7yoBvO3j0s6rqes6E4aCHn7N+kRYS/emSCXWvvhWr ozVBYCB1Mom1N26HNL9rG/b13nFB/L0j0jbpDD5mTXatAH3zh2Qo+hmjMNgK6cjcWq86 zQpF+GXmN5/TKTd1CLpJoH4MjFfdYvQoNr15sxEhu4M/xN294Q7P/Qx1zd8dyJ+ntlO6 wIwnKIjUaqSQWcyc3X+KrEvUsG5oB/vF3owKGPEJN+GEBy9AT2AZPMPxpCZ94B2Tsk/j kydlJurZ6KR+Pq+L5EV71pTWdVOBntPrRSezkZ14WcblRU42izrYw3pLTP8mKmFo0z4L 4Y1Q== X-Gm-Message-State: AOAM533SR6/VYS5exY1y4sR39DW1ajMORC4zbXid0NN7ezvRW/vObwHh NJnZyhxFhJ+mOeACFmQwHtU= X-Received: by 2002:a05:651c:1291:: with SMTP id 17mr11436997ljc.366.1598564075120; Thu, 27 Aug 2020 14:34:35 -0700 (PDT) Received: from localhost.localdomain ([213.87.147.111]) by smtp.googlemail.com with ESMTPSA id f12sm486190lfj.50.2020.08.27.14.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 14:34:34 -0700 (PDT) From: Denis Efremov To: Greg Kroah-Hartman Cc: Denis Efremov , Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH] char: mspec: Use kvzalloc() in mspec_mmap() Date: Fri, 28 Aug 2020 00:34:21 +0300 Message-Id: <20200827213421.50429-1-efremov@linux.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kvzalloc() in mspec_mmap() instead of open-coding it. Signed-off-by: Denis Efremov --- drivers/char/mspec.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c index 0fae33319d2e..f8231e2e84be 100644 --- a/drivers/char/mspec.c +++ b/drivers/char/mspec.c @@ -195,10 +195,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma, pages = vma_pages(vma); vdata_size = sizeof(struct vma_data) + pages * sizeof(long); - if (vdata_size <= PAGE_SIZE) - vdata = kzalloc(vdata_size, GFP_KERNEL); - else - vdata = vzalloc(vdata_size); + vdata = kvzalloc(vdata_size, GFP_KERNEL); if (!vdata) return -ENOMEM; -- 2.26.2