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 2/4] gpiolib: cdev: allocate linereq using kvzalloc()
Date: Wed, 20 Dec 2023 09:51:04 +0800 [thread overview]
Message-ID: <20231220015106.16732-3-warthog618@gmail.com> (raw)
In-Reply-To: <20231220015106.16732-1-warthog618@gmail.com>
The size of struct linereq may exceed a page, so allocate space for
it using kvzalloc() instead of kzalloc().
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 44d864f63130..6fec793f5513 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;
--
2.39.2
next prev parent reply other threads:[~2023-12-20 1:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-20 1:51 [PATCH 0/4] gpiolib: cdev: guard tidying Kent Gibson
2023-12-20 1:51 ` [PATCH 1/4] gpiolib: cdev: include overflow.h Kent Gibson
2023-12-20 1:51 ` Kent Gibson [this message]
2023-12-20 14:30 ` [PATCH 2/4] gpiolib: cdev: allocate linereq using kvzalloc() Andy Shevchenko
2023-12-20 14:53 ` Kent Gibson
2023-12-20 14:58 ` Andy Shevchenko
2023-12-20 1:51 ` [PATCH 3/4] gpiolib: cdev: replace locking wrappers for config_mutex with guards Kent Gibson
2023-12-20 1:51 ` [PATCH 4/4] gpiolib: cdev: replace locking wrappers for gpio_device " Kent Gibson
2023-12-20 11:55 ` Linus Walleij
2023-12-20 12:05 ` Bartosz Golaszewski
2023-12-20 12:13 ` Kent Gibson
2023-12-20 12:16 ` Bartosz Golaszewski
2023-12-20 12:23 ` Kent Gibson
2023-12-20 12:30 ` Bartosz Golaszewski
2023-12-20 12:53 ` Kent Gibson
2023-12-20 13:19 ` Bartosz Golaszewski
2023-12-20 13:28 ` Kent Gibson
2023-12-20 13:47 ` Bartosz Golaszewski
2023-12-20 13:53 ` Kent Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231220015106.16732-3-warthog618@gmail.com \
--to=warthog618@gmail.com \
--cc=andy@kernel.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).