mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-23 14:07:42 +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 += -Wall -ffunction-sections
|
||||||
CFLAGS += -Werror
|
CFLAGS += -Werror
|
||||||
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
|
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 += -fpie
|
||||||
|
|
||||||
CFLAGS += -I$(BASEDIR)/include
|
CFLAGS += -I$(BASEDIR)/include
|
||||||
|
@ -355,7 +355,7 @@ static int create_hugetlb_dirs(int level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(tmp_path, '\0', MAX_PATH_LEN);
|
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))
|
if ((tmp_path[len - 1] != '/') && (len < MAX_PATH_LEN - 1))
|
||||||
tmp_path[len] = '/';
|
tmp_path[len] = '/';
|
||||||
|
@ -279,7 +279,8 @@ int set_wakeup_timer(time_t t)
|
|||||||
|
|
||||||
req.data.rtc_timer.t = t;
|
req.data.rtc_timer.t = t;
|
||||||
strncpy(req.data.rtc_timer.vmname, vmname,
|
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));
|
memset(&ack, 0, sizeof(struct mngr_msg));
|
||||||
ret = mngr_send_msg(acrnd_fd, &req, &ack, 2);
|
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)
|
uint64_t pio_len)
|
||||||
{
|
{
|
||||||
/* init kdev */
|
/* 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->vmid = vmid;
|
||||||
kdev->nvq = nvq;
|
kdev->nvq = nvq;
|
||||||
kdev->negotiated_features = feature;
|
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)
|
uint64_t pio_len)
|
||||||
{
|
{
|
||||||
/* init kdev */
|
/* 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.vmid = vmid;
|
||||||
kdev.nvq = nvq;
|
kdev.nvq = nvq;
|
||||||
kdev.negotiated_features = feature;
|
kdev.negotiated_features = feature;
|
||||||
|
@ -124,7 +124,8 @@ virtio_ipu_k_dev_set(struct vbs_dev_info *ipu_kdev,
|
|||||||
uint64_t pio_len)
|
uint64_t pio_len)
|
||||||
{
|
{
|
||||||
/* init kdev */
|
/* 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->vmid = vmid;
|
||||||
ipu_kdev->nvq = nvq;
|
ipu_kdev->nvq = nvq;
|
||||||
ipu_kdev->negotiated_features = feature;
|
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 */
|
/* FE driver has set VIRTIO_CONFIG_S_DRIVER_OK */
|
||||||
|
|
||||||
/* init kdev */
|
/* 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->vmid = vmid;
|
||||||
kdev->nvq = nvq;
|
kdev->nvq = nvq;
|
||||||
kdev->negotiated_features = feature;
|
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)
|
static int32_t emulate_movs(struct acrn_vcpu *vcpu, const struct instr_emul_vie *vie)
|
||||||
{
|
{
|
||||||
uint64_t src_gva, gpa, val = 0UL;
|
uint64_t src_gva, gpa, val = 0UL;
|
||||||
uint64_t rcx, rdi, rsi, rflags;
|
uint64_t rcx = 0UL, rdi, rsi, rflags;
|
||||||
uint32_t err_code;
|
uint32_t err_code;
|
||||||
enum cpu_reg_name seg;
|
enum cpu_reg_name seg;
|
||||||
int32_t error;
|
int32_t error;
|
||||||
|
@ -85,7 +85,8 @@ int main(int argc, char *argv[])
|
|||||||
NULL)) != -1) {
|
NULL)) != -1) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case 'c':
|
case 'c':
|
||||||
strncpy(cfg, optarg, PATH_MAX);
|
strncpy(cfg, optarg, PATH_MAX - 1);
|
||||||
|
cfg[PATH_MAX - 1] = 0;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage();
|
usage();
|
||||||
|
@ -323,7 +323,8 @@ static int create_new_server(const char *name)
|
|||||||
goto sock_err;
|
goto sock_err;
|
||||||
}
|
}
|
||||||
mfd->addr.sun_family = AF_UNIX;
|
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));
|
ret = bind(mfd->fd, (struct sockaddr *)&mfd->addr, sizeof(mfd->addr));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -212,7 +212,7 @@ static inline int _get_vmname_suffix(const char *src,
|
|||||||
name[max_len_name - 1] = '\0';
|
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")))
|
if (strncmp(suffix, "sh", strlen("sh")))
|
||||||
return -1;
|
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: ");
|
vmname_p = src + strlen("acrnctl: ");
|
||||||
|
|
||||||
memset(vmname, 0, max_len_vmname);
|
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]) {
|
if(vmname[max_len_vmname - 1]) {
|
||||||
/* vmname is truncated */
|
/* vmname is truncated */
|
||||||
printf("get vmname failed, vmname is truncated\n");
|
printf("get vmname failed, vmname is truncated\n");
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
/* acrnd worker timer */
|
/* acrnd worker timer */
|
||||||
|
|
||||||
struct work_arg {
|
struct work_arg {
|
||||||
char name[VMNAME_LEN];
|
char name[VMNAME_LEN + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acrnd_work {
|
struct acrnd_work {
|
||||||
|
Loading…
Reference in New Issue
Block a user