Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1553940 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-01-08 22:50 +0100 |
| Last post | 2017-01-12 13:10 +0100 |
| Articles | 2 on this page of 22 — 6 participants |
Back to article view | Back to linux.kernel
[PATCH 0/8] MMC-core: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 22:50 +0100
[PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 22:50 +0100
Re: [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 5/8] mmc/core/mmc_test: Combine substrings for 5 messages Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:40 +0100
[PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 22:50 +0100
Re: [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 4/8] mmc/core/mmc_test: Add some spaces for better code readability Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:40 +0100
[PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 22:50 +0100
Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() Chunyan Zhang <zhang.chunyan@linaro.org> - 2017-01-10 08:40 +0100
Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:50 +0100
Re: [PATCH 1/8] mmc-core: Use kmalloc_array() in mmc_test_area_init() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-11 03:00 +0100
[PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 23:00 +0100
Re: [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem() Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 7/8] mmc-core: Use kcalloc() in mmc_test_alloc_mem() Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:30 +0100
[PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 23:00 +0100
Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 6/8] mmc/core/mmc_test: Improve a size determination in five functions Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:40 +0100
[PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-08 23:20 +0100
Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg() Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 19:40 +0100
Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg() Shawn Lin <shawn.lin@rock-chips.com> - 2017-01-10 09:30 +0100
Re: [PATCH 0/8] MMC-core: Fine-tuning for some function implementations Ulf Hansson <ulf.hansson@linaro.org> - 2017-01-12 13:10 +0100
Page 2 of 2 — ← Prev page 1 [2]
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Date | 2017-01-10 09:30 +0100 |
| Subject | Re: [PATCH 8/8] mmc-core: Use kmalloc_array() in mmc_alloc_sg() |
| Message-ID | <sXZYC-7oH-15@gated-at.bofh.it> |
| In reply to | #1553952 |
On 2017/1/9 5:55, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 8 Jan 2017 22:10:40 +0100
>
> * A multiplication for the size determination of a memory allocation
> indicated that an array data structure should be processed.
> Thus use the corresponding function "kmalloc_array".
>
> This issue was detected by using the Coccinelle software.
>
> * Replace the specification of a data structure by a pointer dereference
> to make the corresponding size determination a bit safer according to
> the Linux coding style convention.
>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/mmc/core/queue.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
> index a6496d8027bc..b1986622c60e 100644
> --- a/drivers/mmc/core/queue.c
> +++ b/drivers/mmc/core/queue.c
> @@ -152,7 +152,7 @@ static struct scatterlist *mmc_alloc_sg(int sg_len, int *err)
> {
> struct scatterlist *sg;
>
> - sg = kmalloc(sizeof(struct scatterlist)*sg_len, GFP_KERNEL);
> + sg = kmalloc_array(sg_len, sizeof(*sg), GFP_KERNEL);
> if (!sg)
> *err = -ENOMEM;
> else {
>
--
Best Regards
Shawn Lin
[toc] | [prev] | [next] | [standalone]
| From | Ulf Hansson <ulf.hansson@linaro.org> |
|---|---|
| Date | 2017-01-12 13:10 +0100 |
| Message-ID | <sYMmD-3OG-31@gated-at.bofh.it> |
| In reply to | #1553940 |
On 8 January 2017 at 22:38, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sun, 8 Jan 2017 22:30:03 +0100 > > Some update suggestions were taken into account > from static source code analysis. > > Markus Elfring (8): > Use kmalloc_array() in mmc_test_area_init() > Fix a typo in a comment line > Use seq_puts() in mtf_testlist_show() > mmc_test: Add some spaces for better code readability > mmc_test: Combine substrings for 5 messages > mmc_test: Improve a size determination in five functions > Use kcalloc() in mmc_test_alloc_mem() > Use kmalloc_array() in mmc_alloc_sg() > > drivers/mmc/core/mmc_test.c | 77 +++++++++++++++++++++------------------------ > drivers/mmc/core/queue.c | 2 +- > 2 files changed, 36 insertions(+), 43 deletions(-) > Thanks applied for next, with some changes to the prefix of the commit message headers. Kind regards Uffe
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.kernel
csiph-web