diff mbox

[edk2,v2,1/1] EmbeddedPkg/AndroidFastboot: fix size with 64bit

Message ID BLU436-SMTP1834F1B59A14DCE260CB6E097BA0@phx.gbl
State Accepted
Commit cb1d0668a5e7554c7250581c47f69434674c7cbe
Headers show

Commit Message

Haojian Zhuang Feb. 29, 2016, 2:51 p.m. UTC
Since there's percentage calcution, multiply on 32bit variable
will cause overflow. So fix the variables as 64bit.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>

---
 EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Feb. 29, 2016, 3:29 p.m. UTC | #1
On 29 February 2016 at 14:51, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
> Since there's percentage calcution, multiply on 32bit variable

> will cause overflow. So fix the variables as 64bit.

>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>

> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>


Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


Thanks, pushed.

> ---

>  EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c

> index f380817..9ddc34f 100644

> --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c

> +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c

> @@ -45,9 +45,9 @@ typedef enum {

>  STATIC ANDROID_FASTBOOT_STATE mState = ExpectCmdState;

>

>  // When in ExpectDataState, the number of bytes of data to expect:

> -STATIC UINT32 mNumDataBytes;

> +STATIC UINT64 mNumDataBytes;

>  // .. and the number of bytes so far received this data phase

> -STATIC UINT32 mBytesReceivedSoFar;

> +STATIC UINT64 mBytesReceivedSoFar;

>  // .. and the buffer to save data into

>  STATIC UINT8 *mDataBuffer = NULL;

>

> --

> 1.9.1

>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c
index f380817..9ddc34f 100644
--- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c
+++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.c
@@ -45,9 +45,9 @@  typedef enum {
 STATIC ANDROID_FASTBOOT_STATE mState = ExpectCmdState;
 
 // When in ExpectDataState, the number of bytes of data to expect:
-STATIC UINT32 mNumDataBytes;
+STATIC UINT64 mNumDataBytes;
 // .. and the number of bytes so far received this data phase
-STATIC UINT32 mBytesReceivedSoFar;
+STATIC UINT64 mBytesReceivedSoFar;
 // .. and the buffer to save data into
 STATIC UINT8 *mDataBuffer = NULL;