summaryrefslogtreecommitdiffstats
path: root/tools/hv
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-09-19 08:15:30 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2024-09-19 08:15:30 +0200
commit1d7bb2bf7ad8c95cd50e97a83461610385b5259d (patch)
tree047b42c16ded5ea12cad3ef7f0296f752b7e07c7 /tools/hv
parentMerge tag 'powerpc-6.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/p... (diff)
parenttools/hv: Add memory allocation check in hv_fcopy_start (diff)
downloadlinux-1d7bb2bf7ad8c95cd50e97a83461610385b5259d.tar.xz
linux-1d7bb2bf7ad8c95cd50e97a83461610385b5259d.zip
Merge tag 'hyperv-next-signed-20240916' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux
Pull Hyper-V updates from Wei Liu: - Optimize boot time by concurrent execution of hv_synic_init() (Saurabh Sengar) - Use helpers to read control registers in hv_snp_boot_ap() (Yosry Ahmed) - Add memory allocation check in hv_fcopy_start (Zhu Jun) * tag 'hyperv-next-signed-20240916' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux: tools/hv: Add memory allocation check in hv_fcopy_start x86/hyperv: use helpers to read control registers in hv_snp_boot_ap() Drivers: hv: vmbus: Optimize boot time by concurrent execution of hv_synic_init()
Diffstat (limited to 'tools/hv')
-rw-r--r--tools/hv/hv_fcopy_uio_daemon.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/hv/hv_fcopy_uio_daemon.c b/tools/hv/hv_fcopy_uio_daemon.c
index 3ce316cc9f97..7a00f3066a98 100644
--- a/tools/hv/hv_fcopy_uio_daemon.c
+++ b/tools/hv/hv_fcopy_uio_daemon.c
@@ -296,6 +296,13 @@ static int hv_fcopy_start(struct hv_start_fcopy *smsg_in)
file_name = (char *)malloc(file_size * sizeof(char));
path_name = (char *)malloc(path_size * sizeof(char));
+ if (!file_name || !path_name) {
+ free(file_name);
+ free(path_name);
+ syslog(LOG_ERR, "Can't allocate memory for file name and/or path name");
+ return HV_E_FAIL;
+ }
+
wcstoutf8(file_name, (__u16 *)in_file_name, file_size);
wcstoutf8(path_name, (__u16 *)in_path_name, path_size);