From f2e3e9433011a00ca5a9155fca8e0c35f21df12b Mon Sep 17 00:00:00 2001 From: Zheng Zengkai Date: Mon, 10 Jan 2022 09:49:38 +0800 Subject: [PATCH] BMA: Fix format string compile warning in arm32 builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit driver inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4ETXO CVE: NA ----------------------------------------- Fix following build warnings in arm32 builds: drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c: In function ‘bma_cdev_add_msg’: drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h:92:20: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘size_t {aka unsigned int}’ [-Wformat=] drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.c: In function ‘veth_recv_pkt’: drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.c:74:37: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 7 has type ‘dma_addr_t {aka unsigned int}’ [-Wformat=] Signed-off-by: Zheng Zengkai Reviewed-by: Kefeng Wang Signed-off-by: Zheng Zengkai --- .../bma/cdev_veth_drv/virtual_cdev_eth_net.c | 14 +++++++------- .../net/ethernet/huawei/bma/edma_drv/bma_devintf.c | 2 +- .../net/ethernet/huawei/bma/edma_drv/edma_host.c | 2 +- drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c b/drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c index 04ea55f4e0a2..d8c3ab655566 100644 --- a/drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c +++ b/drivers/net/ethernet/huawei/bma/cdev_veth_drv/virtual_cdev_eth_net.c @@ -605,7 +605,7 @@ static int edma_veth_cut_tx_packet_send(struct edma_eth_dev_s *eth_dev, do_queue_rate_limit(eth_dev->ptx_queue); while (length > 0) { - LOG(DLOG_DEBUG, "length: %u/%lu", length, len); + LOG(DLOG_DEBUG, "length: %u/%zu", length, len); if (length > BSPPACKET_MTU_MAX) { /* fragment. */ @@ -1689,7 +1689,7 @@ static ssize_t cdev_copy_packet_to_user(struct edma_eth_dev_s *dev, start = dev->rx_packet[dev->rx_packet_head].packet + g_read_pos; LOG(DLOG_DEBUG, - "User needs %ld bytes, pos: %u, total len: %u, left: %ld.", + "User needs %zu bytes, pos: %u, total len: %u, left: %zd.", count, g_read_pos, dev->rx_packet[dev->rx_packet_head].len, left); if (left <= 0) { /* No more data in this message, retry. */ @@ -1721,7 +1721,7 @@ static ssize_t cdev_copy_packet_to_user(struct edma_eth_dev_s *dev, } LOG(DLOG_DEBUG, - "Copied bytes: %ld, pos: %d, buf len: %lu, free_packet: %d.", + "Copied bytes: %zd, pos: %d, buf len: %zu, free_packet: %d.", length, g_read_pos, count, free_packet); if (packet) { @@ -1807,11 +1807,11 @@ ssize_t cdev_read(struct file *filp, char __user *data, if (!data || count >= MAX_PACKET_LEN) return -EFAULT; - LOG(DLOG_DEBUG, "read begin, count: %ld, pos: %u.", count, g_read_pos); + LOG(DLOG_DEBUG, "read begin, count: %zu, pos: %u.", count, g_read_pos); length = cdev_copy_packet_to_user(dev, data, count); - LOG(DLOG_DEBUG, "read done, length: %ld, pos: %u.", length, g_read_pos); + LOG(DLOG_DEBUG, "read done, length: %zd, pos: %u.", length, g_read_pos); return length; } @@ -1837,7 +1837,7 @@ ssize_t cdev_write(struct file *filp, const char __user *data, g_peer_not_ready = 0; } - LOG(DLOG_DEBUG, "data length is %lu, pos: %u (%u/%u)", + LOG(DLOG_DEBUG, "data length is %zu, pos: %u (%u/%u)", count, g_read_pos, pdev->ptx_queue->pshmqhd_v->count, pdev->ptx_queue->pshmqhd_v->total); @@ -1859,4 +1859,4 @@ MODULE_DESCRIPTION("HUAWEI CDEV DRIVER"); MODULE_LICENSE("GPL"); module_init(edma_cdev_init); -module_exit(edma_cdev_exit); \ No newline at end of file +module_exit(edma_cdev_exit); diff --git a/drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c b/drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c index 7817f58f8635..acf6bbfc50ff 100644 --- a/drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c +++ b/drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c @@ -497,7 +497,7 @@ int bma_cdev_add_msg(void *handle, const char __user *msg, size_t msg_len) hdr->sub_type = priv->user.sub_type; hdr->user_id = priv->user.user_id; hdr->datalen = msg_len; - BMA_LOG(DLOG_DEBUG, "msg_len is %ld\n", msg_len); + BMA_LOG(DLOG_DEBUG, "msg_len is %zu\n", msg_len); if (copy_from_user(hdr->data, msg, msg_len)) { BMA_LOG(DLOG_ERROR, "copy_from_user error\n"); diff --git a/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c b/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c index 2d5f4ffd79d9..3525d41c865f 100644 --- a/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c +++ b/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c @@ -789,7 +789,7 @@ static int edma_host_send_msg(struct edma_host_s *edma_host) if (edma_host->msg_send_write > HOST_MAX_SEND_MBX_LEN - SIZE_OF_MBX_HDR) { BMA_LOG(DLOG_ERROR, - "Length of send message %u is larger than %lu\n", + "Length of send message %u is larger than %zu\n", edma_host->msg_send_write, HOST_MAX_SEND_MBX_LEN - SIZE_OF_MBX_HDR); edma_host->msg_send_write = 0; diff --git a/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.c b/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.c index 9681ce3bfc7b..240db31d7178 100644 --- a/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.c +++ b/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.c @@ -1488,8 +1488,8 @@ s32 veth_recv_pkt(struct bspveth_rxtx_q *prx_queue, int queue) skb->len, skb->protocol); VETH_LOG(DLOG_DEBUG, - "dma_p=0x%llx,dma_map=0x%llx,", - pbd_v->dma_p, dma_map); + "dma_p=0x%llx,dma_map=%pad,", + pbd_v->dma_p, &dma_map); VETH_LOG(DLOG_DEBUG, "skb=%p,skb->data=%p,skb->len=%d,tail=%d,shm_off=%d\n", -- GitLab