mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
build: fix build issue with latest gcc
Fix build issues with gcc 9.1 version Tracked-On: #3121 Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
parent
57ac00a61f
commit
634e310f9b
@ -18,7 +18,7 @@ CFLAGS += -m64
|
||||
CFLAGS += -Wall -ffunction-sections
|
||||
CFLAGS += -Werror
|
||||
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
|
||||
CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
|
||||
CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing -Wno-address-of-packed-member
|
||||
CFLAGS += -fpie
|
||||
|
||||
CFLAGS += -I$(BASEDIR)/include
|
||||
|
@ -355,7 +355,7 @@ static int create_hugetlb_dirs(int level)
|
||||
}
|
||||
|
||||
memset(tmp_path, '\0', MAX_PATH_LEN);
|
||||
strncpy(tmp_path, path, MAX_PATH_LEN);
|
||||
strncpy(tmp_path, path, MAX_PATH_LEN - 1);
|
||||
|
||||
if ((tmp_path[len - 1] != '/') && (len < MAX_PATH_LEN - 1))
|
||||
tmp_path[len] = '/';
|
||||
|
@ -279,7 +279,8 @@ int set_wakeup_timer(time_t t)
|
||||
|
||||
req.data.rtc_timer.t = t;
|
||||
strncpy(req.data.rtc_timer.vmname, vmname,
|
||||
sizeof(req.data.rtc_timer.vmname));
|
||||
sizeof(req.data.rtc_timer.vmname) - 1);
|
||||
req.data.rtc_timer.vmname[sizeof(req.data.rtc_timer.vmname) - 1] = 0;
|
||||
|
||||
memset(&ack, 0, sizeof(struct mngr_msg));
|
||||
ret = mngr_send_msg(acrnd_fd, &req, &ack, 2);
|
||||
|
@ -120,7 +120,8 @@ virtio_audio_kernel_dev_set(struct vbs_dev_info *kdev, const char *name,
|
||||
uint64_t pio_len)
|
||||
{
|
||||
/* init kdev */
|
||||
strncpy(kdev->name, name, VBS_NAME_LEN);
|
||||
strncpy(kdev->name, name, VBS_NAME_LEN - 1);
|
||||
kdev->name[VBS_NAME_LEN - 1] = 0;
|
||||
kdev->vmid = vmid;
|
||||
kdev->nvq = nvq;
|
||||
kdev->negotiated_features = feature;
|
||||
|
@ -115,7 +115,8 @@ virtio_hyper_dmabuf_k_dev_set(const char *name, int vmid, int nvq,
|
||||
uint64_t pio_len)
|
||||
{
|
||||
/* init kdev */
|
||||
strncpy(kdev.name, name, VBS_NAME_LEN);
|
||||
strncpy(kdev.name, name, VBS_NAME_LEN - 1);
|
||||
kdev.name[VBS_NAME_LEN - 1] = 0;
|
||||
kdev.vmid = vmid;
|
||||
kdev.nvq = nvq;
|
||||
kdev.negotiated_features = feature;
|
||||
|
@ -124,7 +124,8 @@ virtio_ipu_k_dev_set(struct vbs_dev_info *ipu_kdev,
|
||||
uint64_t pio_len)
|
||||
{
|
||||
/* init kdev */
|
||||
strncpy(ipu_kdev->name, name, VBS_NAME_LEN);
|
||||
strncpy(ipu_kdev->name, name, VBS_NAME_LEN - 1);
|
||||
ipu_kdev->name[VBS_NAME_LEN - 1] = 0;
|
||||
ipu_kdev->vmid = vmid;
|
||||
ipu_kdev->nvq = nvq;
|
||||
ipu_kdev->negotiated_features = feature;
|
||||
|
@ -216,7 +216,8 @@ virtio_rnd_kernel_dev_set(struct vbs_dev_info *kdev, const char *name,
|
||||
/* FE driver has set VIRTIO_CONFIG_S_DRIVER_OK */
|
||||
|
||||
/* init kdev */
|
||||
strncpy(kdev->name, name, VBS_NAME_LEN);
|
||||
strncpy(kdev->name, name, VBS_NAME_LEN - 1);
|
||||
kdev->name[VBS_NAME_LEN - 1] = 0;
|
||||
kdev->vmid = vmid;
|
||||
kdev->nvq = nvq;
|
||||
kdev->negotiated_features = feature;
|
||||
|
@ -965,7 +965,7 @@ exception_inject:
|
||||
static int32_t emulate_movs(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie)
|
||||
{
|
||||
uint64_t src_gva, gpa, val = 0UL;
|
||||
uint64_t rcx, rdi, rsi, rflags;
|
||||
uint64_t rcx = 0UL, rdi, rsi, rflags;
|
||||
uint32_t err_code;
|
||||
enum cpu_reg_name seg;
|
||||
int32_t error;
|
||||
|
@ -85,7 +85,8 @@ int main(int argc, char *argv[])
|
||||
NULL)) != -1) {
|
||||
switch (op) {
|
||||
case 'c':
|
||||
strncpy(cfg, optarg, PATH_MAX);
|
||||
strncpy(cfg, optarg, PATH_MAX - 1);
|
||||
cfg[PATH_MAX - 1] = 0;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
|
@ -323,7 +323,8 @@ static int create_new_server(const char *name)
|
||||
goto sock_err;
|
||||
}
|
||||
mfd->addr.sun_family = AF_UNIX;
|
||||
strncpy(mfd->addr.sun_path, path, sizeof(mfd->addr.sun_path));
|
||||
strncpy(mfd->addr.sun_path, path, sizeof(mfd->addr.sun_path) - 1);
|
||||
mfd->addr.sun_path[sizeof(mfd->addr.sun_path) - 1] = 0;
|
||||
|
||||
ret = bind(mfd->fd, (struct sockaddr *)&mfd->addr, sizeof(mfd->addr));
|
||||
if (ret < 0) {
|
||||
|
@ -212,7 +212,7 @@ static inline int _get_vmname_suffix(const char *src,
|
||||
name[max_len_name - 1] = '\0';
|
||||
}
|
||||
|
||||
strncpy(suffix, p + 1, max_len_suffix);
|
||||
strncpy(suffix, p + 1, max_len_suffix - 1);
|
||||
if (strncmp(suffix, "sh", strlen("sh")))
|
||||
return -1;
|
||||
|
||||
|
@ -144,7 +144,7 @@ static inline int _get_vmname(const char *src, char *vmname, int max_len_vmname)
|
||||
vmname_p = src + strlen("acrnctl: ");
|
||||
|
||||
memset(vmname, 0, max_len_vmname);
|
||||
strncpy(vmname, vmname_p, max_len_vmname);
|
||||
strncpy(vmname, vmname_p, max_len_vmname - 1);
|
||||
if(vmname[max_len_vmname - 1]) {
|
||||
/* vmname is truncated */
|
||||
printf("get vmname failed, vmname is truncated\n");
|
||||
|
@ -23,7 +23,7 @@
|
||||
/* acrnd worker timer */
|
||||
|
||||
struct work_arg {
|
||||
char name[VMNAME_LEN];
|
||||
char name[VMNAME_LEN + 1];
|
||||
};
|
||||
|
||||
struct acrnd_work {
|
||||
|
Loading…
Reference in New Issue
Block a user