Message ID | 20231221012040.17763-4-warthog618@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-7721-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp120209dyi; Wed, 20 Dec 2023 17:21:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzAmKleZPXWze3lCFt6wh7KiKtJU8aC7elB4Iv9tr4heJK965k2urnsLmAiGTA0aDWzQ9i X-Received: by 2002:a2e:9ec4:0:b0:2ca:2d1:9f07 with SMTP id h4-20020a2e9ec4000000b002ca02d19f07mr8983239ljk.5.1703121719263; Wed, 20 Dec 2023 17:21:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703121719; cv=none; d=google.com; s=arc-20160816; b=hTjVhG29wcr/FHf6bW8i/S1tGz/kzRf5hUfnJzl7JDZKzl+GlNP+Dim09fuhAd2fTW b9V6WSGhaEaYfueYzCk51mX2roMZAjylOUH+mUvcKoqxlT13HkFVia2C0KR5R9zKbYhe /xcGoLK1oRB1Rdm+sg6TGrCZr9Vd33cl5epNJrO2VPidiyoqTsj+DDYWr0SumQ7TEa52 Uk7IKvOH6ArUOMN7FRb5z50OhxvV4DsudhwkjxCx+OR0+iAu4Vg0oxBTvMeOYs2E3rQA X7GcGdIYbVDOlq8mCdgwdJ9Yv+0qgq0FZaO+iK+PkdOHrctH5mpZH4fjV1oEYPXYOtCf ZwWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2G9xQuVfP3PvQMdAXCehswOfS0hQP216b/ZuRf+VAvA=; fh=GNOA1jdeAuH+tfAEzFx15vIukVGFZnqrW9xHApUHjl0=; b=piyOhvHPEQ419I2Ri2f+xJyfeKq/7wS0oTanGg4C3gm36de/LlDvsRJ9+yn9imswzk A7wWO9DvPz/hv4N6OObsw6OB0GCZ+BpKOfW0+rGfsMZxMtDoHy/zdLSG4HxEJORA/VrO 6qxkJEccy3/xHAedm1sjrTPi5vc16D4c1yejFDx20bHJinyTGhb9q2XBFMxaJQxZvHr+ eCuC7sLFHdL0Ieg9B6nNUC30a2s0AgdS08zFmA9RwoG2wH7h51nFNTbB32saoUD8y1fB 3hdQAAqRnKtnLY/nrK+qLQAU0t1YZZkkzUc3U3q2GF/uHixQxxzPShH+q+HrmA7dF3qv kBAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UpQHKdco; spf=pass (google.com: domain of linux-kernel+bounces-7721-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7721-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r12-20020a05640251cc00b00553aa95d2afsi360108edd.635.2023.12.20.17.21.59 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 17:21:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7721-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UpQHKdco; spf=pass (google.com: domain of linux-kernel+bounces-7721-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7721-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D9B3C1F24281 for <ouuuleilei@gmail.com>; Thu, 21 Dec 2023 01:21:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B65392917; Thu, 21 Dec 2023 01:21:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UpQHKdco" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5F2F441E; Thu, 21 Dec 2023 01:21:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6d939e2f594so279749b3a.3; Wed, 20 Dec 2023 17:21:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703121703; x=1703726503; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2G9xQuVfP3PvQMdAXCehswOfS0hQP216b/ZuRf+VAvA=; b=UpQHKdcoXOEWAcWuDy31PP25zJVptPd+LUeGrfIi3iVEd/PE2/YLCprDGR5UIj6Hal l9AFsVLl1mp+WHsHQ1UeSLrhPO8+8JSrNcrs4FMWu82a1Y/9BD2O3xkQmSYru4mDAYug /ighy7zw/2h1CDr4mi3n8XZnTO7GWgmwjgjGEDptlVoHAn0xV+gXDi2Aw9y6IA3bpubX P/E8SCvZKs3HaLmsJch1huEk12CoWRyzAxvkTBmZU+3CxqqwY/JJHnT/66fIo14DykEC LoTxZdc7z8DsjZxXxa1/uYjC+7ljVwPqbPIAxZ/SSpHTIXjn5bBTXp8+MoOXl/sdGeM1 lqJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703121703; x=1703726503; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2G9xQuVfP3PvQMdAXCehswOfS0hQP216b/ZuRf+VAvA=; b=jQyy+Hwq/6UK28qHB0JRmE3UvIVH9DjlfO3OPSp2YlWcKybWsOQfZxySQuZRMw0J7x DJ783CNaCjeQcj0pf0RZJSLHEHSR9oLYfE8/OwhuY6gedPLaoL1907JjuMvFG8eotlgE uQwACUe1SUDjCUg4Fn7mqdJBXHDDBhG7N479/AACETnBQ8yJZB1UCzUQs4072I9eiLtR kRrQ/AXiznriZowbQei+V8+9O/UjHQMFuR7rAi5/F/WD2pOpUWyidzl5z61Ot3IS+JRs a824tCtwcj3FjnWCSe2dnp3jIf2TShitgaewqmzPmY3eilPqDMmjdNPkF4W1oyGz/k7y ODZQ== X-Gm-Message-State: AOJu0YzmTTaFnsH2VVylnSzt4Ap4WQdDiVF49cDPpwlKjhbsmFIh9/mh Dy/PqsjdUJvb981RCf4eJlbYBDNEYwE= X-Received: by 2002:a05:6a20:7da4:b0:194:dd52:bdc7 with SMTP id v36-20020a056a207da400b00194dd52bdc7mr856347pzj.56.1703121703104; Wed, 20 Dec 2023 17:21:43 -0800 (PST) Received: from rigel.home.arpa (60-241-235-125.tpgi.com.au. [60.241.235.125]) by smtp.gmail.com with ESMTPSA id x1-20020a056a00270100b006d088356541sm375959pfv.104.2023.12.20.17.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 17:21:42 -0800 (PST) From: Kent Gibson <warthog618@gmail.com> To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, brgl@bgdev.pl, linus.walleij@linaro.org, andy@kernel.org Cc: Kent Gibson <warthog618@gmail.com> Subject: [PATCH v2 3/5] gpiolib: cdev: allocate linereq using kvzalloc() Date: Thu, 21 Dec 2023 09:20:38 +0800 Message-Id: <20231221012040.17763-4-warthog618@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221012040.17763-1-warthog618@gmail.com> References: <20231221012040.17763-1-warthog618@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785852559594676939 X-GMAIL-MSGID: 1785852559594676939 |
Series |
gpiolib: cdev: guard tidying
|
|
Commit Message
Kent Gibson
Dec. 21, 2023, 1:20 a.m. UTC
The size of struct linereq may exceed a page, so allocate space for
it using kvzalloc() instead of kzalloc() to handle the case where
memory is heavily fragmented and kzalloc() cannot find a sufficient
contiguous region.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
drivers/gpio/gpiolib-cdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 942fe115b726..5424c878627e 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -1723,7 +1723,7 @@ static void linereq_free(struct linereq *lr) kfifo_free(&lr->events); kfree(lr->label); gpio_device_put(lr->gdev); - kfree(lr); + kvfree(lr); } static int linereq_release(struct inode *inode, struct file *file) @@ -1788,7 +1788,7 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip) if (ret) return ret; - lr = kzalloc(struct_size(lr, lines, ulr.num_lines), GFP_KERNEL); + lr = kvzalloc(struct_size(lr, lines, ulr.num_lines), GFP_KERNEL); if (!lr) return -ENOMEM; lr->num_lines = ulr.num_lines;