From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B7063A0542; Tue, 31 May 2022 11:20:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D3BE400EF; Tue, 31 May 2022 11:20:18 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 29E8B400D6 for ; Tue, 31 May 2022 11:20:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653988816; x=1685524816; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=m3CFDA60AOClckLs9D6PdjfZIF9BRroaweWlZ3v3+is=; b=dgtliRewv9CigEyJSxOkR4WXzo3c1ca5MQ8XeyfzQxd7e6uEr8uWcChF P4xI0c3FNYGCI6wGSE29Kuv4JW9X2V7gFS5CnGRqh6VX2SFUy8jjQKC1O tlUcUiVtCCxuKJqYGVk8fzpL59Rf/PlqxrhnTyrhgn0+4Lm9QsxwDLfM+ SNuADaaJUxI0deuY2ePIokocKgw11TQD/wEvzvjSnqqCns84kHQXvjLXb 8s1Urjf27wFeDfNFhEMiEVxjbMYQnRk6wLkHgUqEZJMvSwOd+c/DMQzNu jiQQ4D5j++Xqd+DxpuPNNXd3PSnaFv+yXXw5IElelDdt0XFmeqSyj8Krm w==; X-IronPort-AV: E=McAfee;i="6400,9594,10363"; a="338238344" X-IronPort-AV: E=Sophos;i="5.91,264,1647327600"; d="scan'208";a="338238344" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 02:20:08 -0700 X-IronPort-AV: E=Sophos;i="5.91,264,1647327600"; d="scan'208";a="605576670" Received: from unknown (HELO localhost.localdomain) ([10.239.251.104]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 02:20:06 -0700 From: Ke Zhang To: ferruh.yigit@intel.com, dev@dpdk.org Cc: Ke Zhang Subject: [PATCH] examples/kni: clear warning about discarding const qualifier Date: Tue, 31 May 2022 09:13:30 +0000 Message-Id: <20220531091330.230715-1-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The warning info: warning: passing argument 1 of ‘memcpy’ discards ‘const’ qualifier from pointer target type Compulsory type conversion to clear compile warning. Signed-off-by: Ke Zhang --- kernel/linux/kni/kni_misc.c | 4 ++-- kernel/linux/kni/kni_net.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c index 780187d8bf..6f9dab4732 100644 --- a/kernel/linux/kni/kni_misc.c +++ b/kernel/linux/kni/kni_misc.c @@ -403,10 +403,10 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num, /* if user has provided a valid mac address */ if (is_valid_ether_addr(dev_info.mac_addr)) - memcpy(net_dev->dev_addr, dev_info.mac_addr, ETH_ALEN); + memcpy((unsigned char *)net_dev->dev_addr, dev_info.mac_addr, ETH_ALEN); else /* Generate random MAC address. */ - eth_random_addr(net_dev->dev_addr); + eth_random_addr((uint8_t *)net_dev->dev_addr); if (dev_info.mtu) net_dev->mtu = dev_info.mtu; diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c index 29e5b9e21f..fd54b6fe0f 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -779,7 +779,7 @@ kni_net_set_mac(struct net_device *netdev, void *p) return -EADDRNOTAVAIL; memcpy(req.mac_addr, addr->sa_data, netdev->addr_len); - memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); + memcpy((unsigned char *)netdev->dev_addr, addr->sa_data, netdev->addr_len); ret = kni_net_process_request(netdev, &req); -- 2.25.1