From: Artem Bityutskiy <dedekind@infradead.org>
To: Vinit Agnihotri <vinit.agnihotri@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: overflows while calculating volume->used_bytes
Date: Tue, 10 Jul 2007 10:01:08 +0300 [thread overview]
Message-ID: <1184050868.3531.67.camel@sauron> (raw)
In-Reply-To: <9b52d64c0707092237x48c149cdy24b6eaf1d0baa184@mail.gmail.com>
Vinit,
On Tue, 2007-07-10 at 11:07 +0530, Vinit Agnihotri wrote:
> I was experiencing overflows in multiplications for
> volume->used_bytes in vmt.c & vtbl.c, while creating & resizing large volumes.
>
> vol->used_bytes is long long however its 2 operands vol->used_ebs &
> vol->usable_leb_size
> are int. So their multiplication for larger values causes integer overflows.
> Typecasting them solves the problem.
>
> My machine & flash details:
>
> 64Bit dual-core AMD opteron, 1 GB RAM, linux 2.6.18.3.
> mtd size = 6GB, volume size= 5GB, peb_size = 4MB.
>
> heres patch which does the fix.
Thanks for the patch. Just one note:
you can add only one (long long) prefix before the first operand, no
need to add it to the second one and make the line too long so that
you need to split it.
> + vol->used_bytes = (long long)vol->used_ebs *
> + (long long)vol->usable_leb_size;
Like here it could be
+ vol->used_bytes = (long long)vol->used_ebs * vol->usable_leb_size;
Otherwise the patch looks good. Will you resend it or you are fine if I
amend it myself?
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
next prev parent reply other threads:[~2007-07-10 7:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-10 5:37 overflows while calculating volume->used_bytes Vinit Agnihotri
2007-07-10 7:01 ` Artem Bityutskiy [this message]
[not found] ` <9b52d64c0707100047k604ca250g94a0657defc6eac3@mail.gmail.com>
2007-07-10 7:58 ` Vinit Agnihotri
2007-07-10 8:14 ` Artem Bityutskiy
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=1184050868.3531.67.camel@sauron \
--to=dedekind@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=vinit.agnihotri@gmail.com \
/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