* [PATCH 1/1] fs/ubifs/super.c: replace count*size kzalloc by kcalloc
@ 2014-06-23 16:41 Fabian Frederick
2014-07-16 6:10 ` Artem Bityutskiy
0 siblings, 1 reply; 3+ messages in thread
From: Fabian Frederick @ 2014-06-23 16:41 UTC (permalink / raw)
To: linux-kernel; +Cc: Fabian Frederick, linux-mtd, Adrian Hunter, Artem Bityutskiy
kcalloc manages count*sizeof overflow.
Cc: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/ubifs/super.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 3904c85..537b91d 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -796,8 +796,8 @@ static int alloc_wbufs(struct ubifs_info *c)
{
int i, err;
- c->jheads = kzalloc(c->jhead_cnt * sizeof(struct ubifs_jhead),
- GFP_KERNEL);
+ c->jheads = kcalloc(c->jhead_cnt, sizeof(struct ubifs_jhead),
+ GFP_KERNEL);
if (!c->jheads)
return -ENOMEM;
--
1.8.4.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] fs/ubifs/super.c: replace count*size kzalloc by kcalloc
2014-06-23 16:41 [PATCH 1/1] fs/ubifs/super.c: replace count*size kzalloc by kcalloc Fabian Frederick
@ 2014-07-16 6:10 ` Artem Bityutskiy
2014-07-16 6:17 ` Artem Bityutskiy
0 siblings, 1 reply; 3+ messages in thread
From: Artem Bityutskiy @ 2014-07-16 6:10 UTC (permalink / raw)
To: Fabian Frederick; +Cc: linux-mtd, linux-kernel, Adrian Hunter
On Mon, 2014-06-23 at 18:41 +0200, Fabian Frederick wrote:
> kcalloc manages count*sizeof overflow.
>
> Cc: Artem Bityutskiy <dedekind1@gmail.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: linux-mtd@lists.infradead.org
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
In the commit message, please, try to not only tell _what_ you do,
but also _why_ you do this. And ideally, but not necessary for this
case, I think, how this was tested (e.g., compile-tested only).
Thanks! I'll apply this patch, and amend the commit message so that it
tells that kcalloc() makes better bob of the overflow checking.
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] fs/ubifs/super.c: replace count*size kzalloc by kcalloc
2014-07-16 6:10 ` Artem Bityutskiy
@ 2014-07-16 6:17 ` Artem Bityutskiy
0 siblings, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2014-07-16 6:17 UTC (permalink / raw)
To: Fabian Frederick; +Cc: linux-mtd, linux-kernel, Adrian Hunter
On Wed, 2014-07-16 at 09:10 +0300, Artem Bityutskiy wrote:
> On Mon, 2014-06-23 at 18:41 +0200, Fabian Frederick wrote:
> > kcalloc manages count*sizeof overflow.
> >
> > Cc: Artem Bityutskiy <dedekind1@gmail.com>
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: linux-mtd@lists.infradead.org
> > Signed-off-by: Fabian Frederick <fabf@skynet.be>
>
> In the commit message, please, try to not only tell _what_ you do,
> but also _why_ you do this. And ideally, but not necessary for this
> case, I think, how this was tested (e.g., compile-tested only).
Oh, I'm sorry, you did tell "why" in this patch, I was looking an the a
different patch of yours (seq_printf). I've applied this patch to
linux-ubifs.git, thanks!
--
Best Regards,
Artem Bityutskiy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-16 6:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-23 16:41 [PATCH 1/1] fs/ubifs/super.c: replace count*size kzalloc by kcalloc Fabian Frederick
2014-07-16 6:10 ` Artem Bityutskiy
2014-07-16 6:17 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox