summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/f_thor.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/f_thor.c')
-rw-r--r--drivers/usb/gadget/f_thor.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index f874509cf38..c8eda058329 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -47,7 +47,7 @@ DEFINE_CACHE_ALIGN_BUFFER(unsigned char, thor_rx_data_buf,
/* ********************************************************** */
/* THOR protocol - transmission handling */
/* ********************************************************** */
-DEFINE_CACHE_ALIGN_BUFFER(char, f_name, F_NAME_BUF_SIZE);
+DEFINE_CACHE_ALIGN_BUFFER(char, f_name, F_NAME_BUF_SIZE + 1);
static unsigned long long int thor_file_size;
static int alt_setting_num;
@@ -262,8 +262,10 @@ static long long int process_rqt_download(const struct rqt_box *rqt)
switch (rqt->rqt_data) {
case RQT_DL_INIT:
- thor_file_size = rqt->int_data[0];
- debug("INIT: total %d bytes\n", rqt->int_data[0]);
+ thor_file_size = (unsigned long long int)rqt->int_data[0] +
+ (((unsigned long long int)rqt->int_data[1])
+ << 32);
+ debug("INIT: total %llu bytes\n", thor_file_size);
break;
case RQT_DL_FILE_INFO:
file_type = rqt->int_data[0];
@@ -274,8 +276,11 @@ static long long int process_rqt_download(const struct rqt_box *rqt)
break;
}
- thor_file_size = rqt->int_data[1];
+ thor_file_size = (unsigned long long int)rqt->int_data[1] +
+ (((unsigned long long int)rqt->int_data[2])
+ << 32);
memcpy(f_name, rqt->str_data[0], F_NAME_BUF_SIZE);
+ f_name[F_NAME_BUF_SIZE] = '\0';
debug("INFO: name(%s, %d), size(%llu), type(%d)\n",
f_name, 0, thor_file_size, file_type);