From patchwork Wed Dec 24 15:04:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 423941 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0DA3414009B for ; Thu, 25 Dec 2014 02:05:35 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752195AbaLXPFG (ORCPT ); Wed, 24 Dec 2014 10:05:06 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:62448 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbaLXPFE (ORCPT ); Wed, 24 Dec 2014 10:05:04 -0500 Received: by mail-pa0-f53.google.com with SMTP id kq14so10033171pab.26; Wed, 24 Dec 2014 07:05:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=qmZuZGSUviTPZ8FZmw07KmLC/aKgmVG6ATvEqNgbk0s=; b=rpK7XLUQXfYQGqDR/AGXNuWJCtct6vZ4qO8pAq8+zV6ORayr3/gT4CwFPDDdyEB5Xj Krwyy6WqYm+MYzU7QAFgjboUYBzsGxbGvXoNS92mXpWOHQFJBIQ1mqgi+mY7NLO0cLtk mp6HbcmPMY/X5+FAwz9wZe18coaC0zkT6G3363Eoj7AG9ZQ74VI2Rj1RNZhS2Bf2mv4I JlU3hsvkfP/nDuDhvDF9apXa/I0exBHiwJISUkzZnRRFw23OoYXmN0mNZvLkAMii5Gan 3s+86g0mtf1xiNvhDx3Bl9tAvYlm11ObyB3W0ljJ74FR+YJn2wZU2YRocYz1WQk008f+ LWXA== X-Received: by 10.70.6.164 with SMTP id c4mr54237123pda.63.1419433503180; Wed, 24 Dec 2014 07:05:03 -0800 (PST) Received: from [192.168.1.102] ([223.72.65.65]) by mx.google.com with ESMTPSA id do3sm23249198pac.48.2014.12.24.07.04.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Dec 2014 07:05:02 -0800 (PST) Message-ID: <549AD616.7070709@gmail.com> Date: Wed, 24 Dec 2014 23:04:54 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu CC: David Miller , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, "linux-kernel@vger.kernel.org" Subject: [PATCH next] net: netfilter: nfnetlink_cthelper: Remove 'const' and '&' to avoid warnings Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org The related code can be simplified, and also can avoid related warnings (with allmodconfig under parisc): CC [M] net/netfilter/nfnetlink_cthelper.o net/netfilter/nfnetlink_cthelper.c: In function ‘nfnl_cthelper_from_nlattr’: net/netfilter/nfnetlink_cthelper.c:97:9: warning: passing argument 1 o ‘memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-array-qualifiers] memcpy(&help->data, nla_data(attr), help->helper->data_len); ^ In file included from include/linux/string.h:17:0, from include/uapi/linux/uuid.h:25, from include/linux/uuid.h:23, from include/linux/mod_devicetable.h:12, from ./arch/parisc/include/asm/hardware.h:4, from ./arch/parisc/include/asm/processor.h:15, from ./arch/parisc/include/asm/spinlock.h:6, from ./arch/parisc/include/asm/atomic.h:21, from include/linux/atomic.h:4, from ./arch/parisc/include/asm/bitops.h:12, from include/linux/bitops.h:36, from include/linux/kernel.h:10, from include/linux/list.h:8, from include/linux/module.h:9, from net/netfilter/nfnetlink_cthelper.c:11: ./arch/parisc/include/asm/string.h:8:8: note: expected ‘void *’ but argument is of type ‘const char (*)[]’ void * memcpy(void * dest,const void *src,size_t count); ^ Signed-off-by: Chen Gang --- net/netfilter/nfnetlink_cthelper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c index 9e287cb..a5599fc 100644 --- a/net/netfilter/nfnetlink_cthelper.c +++ b/net/netfilter/nfnetlink_cthelper.c @@ -86,7 +86,7 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, static int nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) { - const struct nf_conn_help *help = nfct_help(ct); + struct nf_conn_help *help = nfct_help(ct); if (attr == NULL) return -EINVAL; @@ -94,7 +94,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) if (help->helper->data_len == 0) return -EINVAL; - memcpy(&help->data, nla_data(attr), help->helper->data_len); + memcpy(help->data, nla_data(attr), help->helper->data_len); return 0; }