From: Seung-Woo Kim Date: Mon, 10 Apr 2017 11:14:02 +0000 (+0900) Subject: TPL: TM2: f_thor: fix wrong size caused by casting s32 to u64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1186973d6db4c9c52471e4f9054f8da74b7e93e;p=platform%2Fkernel%2Fu-boot.git TPL: TM2: f_thor: fix wrong size caused by casting s32 to u64 Currently, in arm64 environment, thor download for a file more than 2GB size is failed because requested file size is not properly set. It is because of assignment of a signed value to a bigger unsigned type for the size of a file. So this patch fixes wrong size casting. This also fixes to print debug information about the requested file size with casted variable. Change-Id: Id0e67035be05b0df346a8bb0ea17b5ba3e40e8f2 Signed-off-by: Seung-Woo Kim --- diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 7d9fbfdf70..220c32e518 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -280,12 +280,12 @@ static int process_rqt_download(const struct rqt_box *rqt) switch (rqt->rqt_data) { case RQT_DL_INIT: - thor_file_size = (size_t)rqt->int_data[0]; + thor_file_size = (uint32_t)rqt->int_data[0]; #ifdef CONFIG_TIZEN total_file_size = thor_file_size; downloaded_file_size = 0; #endif - debug("INIT: total %zu bytes\n", (size_t)rqt->int_data[0]); + debug("INIT: total %zu bytes\n", thor_file_size); break; case RQT_DL_FILE_INFO: file_type = rqt->int_data[0]; @@ -296,7 +296,7 @@ static int process_rqt_download(const struct rqt_box *rqt) break; } - thor_file_size = (size_t)rqt->int_data[1]; + thor_file_size = (uint32_t)rqt->int_data[1]; memcpy(f_name, rqt->str_data[0], F_NAME_BUF_SIZE); debug("INFO: name(%s, %d), size(%zu), type(%d)\n",