public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
To: <richard.weinberger@gmail.com>, <computersforpeace@gmail.com>
Cc: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>,
	linux-mtd@lists.infradead.org
Subject: [PATCH 2/2] mtd-utils: ubi-tests: fix a some overflows
Date: Mon, 29 Jun 2015 16:49:19 +0800	[thread overview]
Message-ID: <1435567759-32518-2-git-send-email-yangds.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1435567759-32518-1-git-send-email-yangds.fnst@cn.fujitsu.com>

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 tests/ubi-tests/mkvol_bad.c   | 2 +-
 tests/ubi-tests/mkvol_basic.c | 2 +-
 tests/ubi-tests/rsvol.c       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/ubi-tests/mkvol_bad.c b/tests/ubi-tests/mkvol_bad.c
index 27f4795..486fbab 100644
--- a/tests/ubi-tests/mkvol_bad.c
+++ b/tests/ubi-tests/mkvol_bad.c
@@ -106,7 +106,7 @@ static int test_mkvol(void)
 		return -1;
 
 	req.alignment = dev_info.leb_size - dev_info.min_io_size;
-	req.bytes = (dev_info.leb_size - dev_info.leb_size % req.alignment) *
+	req.bytes = (long long)(dev_info.leb_size - dev_info.leb_size % req.alignment) *
 		    dev_info.avail_lebs + 1;
 	ret = ubi_mkvol(libubi, node, &req);
 	if (check_failed(ret, ENOSPC, "ubi_mkvol", "bytes = %lld", req.bytes))
diff --git a/tests/ubi-tests/mkvol_basic.c b/tests/ubi-tests/mkvol_basic.c
index cda7241..2ff6ac1 100644
--- a/tests/ubi-tests/mkvol_basic.c
+++ b/tests/ubi-tests/mkvol_basic.c
@@ -55,7 +55,7 @@ static int mkvol_alignment(void)
 
 		/* Bear in mind alignment reduces EB size */
 		ebsz = dev_info.leb_size - dev_info.leb_size % req.alignment;
-		req.bytes = dev_info.avail_lebs * ebsz;
+		req.bytes = (long long)dev_info.avail_lebs * ebsz;
 
 		req.vol_type = UBI_DYNAMIC_VOLUME;
 		req.name = name;
diff --git a/tests/ubi-tests/rsvol.c b/tests/ubi-tests/rsvol.c
index 60badb0..732bcaa 100644
--- a/tests/ubi-tests/rsvol.c
+++ b/tests/ubi-tests/rsvol.c
@@ -169,7 +169,7 @@ static int test_rsvol1(struct ubi_vol_info *vol_info)
 	}
 
 	if (ubi_rsvol(libubi, node, vol_info->vol_id,
-		      vol_info->leb_size * dev_info.avail_lebs)) {
+		      (long long)vol_info->leb_size * dev_info.avail_lebs)) {
 		failed("ubi_rsvol");
 		return -1;
 	}
-- 
1.8.4.2

  reply	other threads:[~2015-06-29  8:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-29  8:49 [PATCH 1/2] mtd-utils: fs-tests: pass TEST_DIR to integck in run_all.sh Dongsheng Yang
2015-06-29  8:49 ` Dongsheng Yang [this message]
2015-06-30  7:32   ` [PATCH 2/2] mtd-utils: ubi-tests: fix a some overflows Richard Weinberger
2015-07-06 21:45   ` Brian Norris
2015-06-30  7:33 ` [PATCH 1/2] mtd-utils: fs-tests: pass TEST_DIR to integck in run_all.sh Richard Weinberger
2015-07-06 21:42 ` Brian Norris

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=1435567759-32518-2-git-send-email-yangds.fnst@cn.fujitsu.com \
    --to=yangds.fnst@cn.fujitsu.com \
    --cc=computersforpeace@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard.weinberger@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