* [PATCH 0/2] Drivers: hv: util: two fixes @ 2015-06-02 12:56 Vitaly Kuznetsov 2015-06-02 12:56 ` [PATCH 1/2] Drivers: hv: kvp: check kzalloc return value Vitaly Kuznetsov 2015-06-02 12:56 ` [PATCH 2/2] Drivers: hv: fcopy: dynamically allocate smsg_out in fcopy_send_data() Vitaly Kuznetsov 0 siblings, 2 replies; 3+ messages in thread From: Vitaly Kuznetsov @ 2015-06-02 12:56 UTC (permalink / raw) To: devel Cc: K. Y. Srinivasan, Haiyang Zhang, linux-kernel, Dexuan Cui, Dan Carpenter Fix two issues reported by Dan Carpenter and kbuild test robot. Vitaly Kuznetsov (2): Drivers: hv: kvp: check kzalloc return value Drivers: hv: fcopy: dynamically allocate smsg_out in fcopy_send_data() drivers/hv/hv_fcopy.c | 21 +++++++++++++-------- drivers/hv/hv_kvp.c | 3 +++ 2 files changed, 16 insertions(+), 8 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] Drivers: hv: kvp: check kzalloc return value 2015-06-02 12:56 [PATCH 0/2] Drivers: hv: util: two fixes Vitaly Kuznetsov @ 2015-06-02 12:56 ` Vitaly Kuznetsov 2015-06-02 12:56 ` [PATCH 2/2] Drivers: hv: fcopy: dynamically allocate smsg_out in fcopy_send_data() Vitaly Kuznetsov 1 sibling, 0 replies; 3+ messages in thread From: Vitaly Kuznetsov @ 2015-06-02 12:56 UTC (permalink / raw) To: devel Cc: K. Y. Srinivasan, Haiyang Zhang, linux-kernel, Dexuan Cui, Dan Carpenter kzalloc() return value check was accidentally lost in 11bc3a5fa91f: "Drivers: hv: kvp: convert to hv_utils_transport" commit. We don't need to reset kvp_transaction.state here as we have the kvp_timeout_func() timeout function and in case we're in OOM situation it is preferable to wait. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- drivers/hv/hv_kvp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index d85798d..74c38a9 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c @@ -353,6 +353,9 @@ kvp_send_key(struct work_struct *dummy) return; message = kzalloc(sizeof(*message), GFP_KERNEL); + if (!message) + return; + message->kvp_hdr.operation = operation; message->kvp_hdr.pool = pool; in_msg = kvp_transaction.kvp_msg; -- 1.9.3 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] Drivers: hv: fcopy: dynamically allocate smsg_out in fcopy_send_data() 2015-06-02 12:56 [PATCH 0/2] Drivers: hv: util: two fixes Vitaly Kuznetsov 2015-06-02 12:56 ` [PATCH 1/2] Drivers: hv: kvp: check kzalloc return value Vitaly Kuznetsov @ 2015-06-02 12:56 ` Vitaly Kuznetsov 1 sibling, 0 replies; 3+ messages in thread From: Vitaly Kuznetsov @ 2015-06-02 12:56 UTC (permalink / raw) To: devel Cc: K. Y. Srinivasan, Haiyang Zhang, linux-kernel, Dexuan Cui, Dan Carpenter struct hv_start_fcopy is too big to be on stack on i386, the following warning is reported: >> drivers/hv/hv_fcopy.c:159:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=] Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- drivers/hv/hv_fcopy.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c index b50dd33..db4b887 100644 --- a/drivers/hv/hv_fcopy.c +++ b/drivers/hv/hv_fcopy.c @@ -116,7 +116,7 @@ static int fcopy_handle_handshake(u32 version) static void fcopy_send_data(struct work_struct *dummy) { - struct hv_start_fcopy smsg_out; + struct hv_start_fcopy *smsg_out = NULL; int operation = fcopy_transaction.fcopy_msg->operation; struct hv_start_fcopy *smsg_in; void *out_src; @@ -136,21 +136,24 @@ static void fcopy_send_data(struct work_struct *dummy) switch (operation) { case START_FILE_COPY: out_len = sizeof(struct hv_start_fcopy); - memset(&smsg_out, 0, out_len); - smsg_out.hdr.operation = operation; + smsg_out = kzalloc(sizeof(*smsg_out), GFP_KERNEL); + if (!smsg_out) + return; + + smsg_out->hdr.operation = operation; smsg_in = (struct hv_start_fcopy *)fcopy_transaction.fcopy_msg; utf16s_to_utf8s((wchar_t *)smsg_in->file_name, W_MAX_PATH, UTF16_LITTLE_ENDIAN, - (__u8 *)&smsg_out.file_name, W_MAX_PATH - 1); + (__u8 *)&smsg_out->file_name, W_MAX_PATH - 1); utf16s_to_utf8s((wchar_t *)smsg_in->path_name, W_MAX_PATH, UTF16_LITTLE_ENDIAN, - (__u8 *)&smsg_out.path_name, W_MAX_PATH - 1); + (__u8 *)&smsg_out->path_name, W_MAX_PATH - 1); - smsg_out.copy_flags = smsg_in->copy_flags; - smsg_out.file_size = smsg_in->file_size; - out_src = &smsg_out; + smsg_out->copy_flags = smsg_in->copy_flags; + smsg_out->file_size = smsg_in->file_size; + out_src = smsg_out; break; default: @@ -168,6 +171,8 @@ static void fcopy_send_data(struct work_struct *dummy) fcopy_transaction.state = HVUTIL_READY; } } + kfree(smsg_out); + return; } -- 1.9.3 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-02 12:56 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-06-02 12:56 [PATCH 0/2] Drivers: hv: util: two fixes Vitaly Kuznetsov 2015-06-02 12:56 ` [PATCH 1/2] Drivers: hv: kvp: check kzalloc return value Vitaly Kuznetsov 2015-06-02 12:56 ` [PATCH 2/2] Drivers: hv: fcopy: dynamically allocate smsg_out in fcopy_send_data() Vitaly Kuznetsov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®