Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1500438
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 01/18] [media] RedRat3: Use kcalloc() in two functions |
| Date | 2016-10-13 18:40 +0200 |
| Message-ID | <srRcZ-5TH-13@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <srR3j-5Qh-3@gated-at.bofh.it> <srR3j-5Qh-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 2016-10-13 at 18:18 +0200, SF Markus Elfring wrote:
> diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
[]
> @@ -549,7 +549,7 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3)
> int rc = 0;
> char *buffer;
>
> - buffer = kzalloc(sizeof(char) * (RR3_FW_VERSION_LEN + 1), GFP_KERNEL);
> + buffer = kcalloc(RR3_FW_VERSION_LEN + 1, sizeof(*buffer), GFP_KERNEL);
> if (!buffer) {
> dev_err(rr3->dev, "Memory allocation failure\n");
> return;,
Markus, please stop being _so_ mechanical and use your
brain a little too. By definition, sizeof(char) == 1.
This _really_ should be kzalloc(RR3_FW_VERSION_LEN + 1,...)
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 01/18] [media] RedRat3: Use kcalloc() in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-13 18:30 +0200
Re: [PATCH 01/18] [media] RedRat3: Use kcalloc() in two functions Joe Perches <joe@perches.com> - 2016-10-13 18:40 +0200
Re: [media] RedRat3: Use kcalloc() in two functions? SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-14 07:50 +0200
csiph-web