mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: "'Joel Pelaez Jorge'" <joelpelaez@gmail.com>
Cc: "'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>,
	"'Joe Perches'" <joe@perches.com>,
	"'Rashika Kheria'" <rashika.kheria@gmail.com>,
	"'Peter P Waskiewicz Jr'" <peter.p.waskiewicz.jr@intel.com>,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	"'Wei Yongjun'" <yongjun_wei@trendmicro.com.cn>,
	"'Dan Carpenter'" <dan.carpenter@oracle.com>,
	"'Jingoo Han'" <jg1.han@samsung.com>
Subject: Re: [PATCH] staging: slicoss: Fix prefer ether_addr_copy over memcpy
Date: Tue, 18 Mar 2014 12:38:12 +0900	[thread overview]
Message-ID: <002401cf425b$7d1db5f0$775921d0$%han@samsung.com> (raw)
In-Reply-To: <5327BACF.5020102@gmail.com>

On Tuesday, March 18, 2014 12:18 PM, Joel Pelaez Jorge wrote:
> 
> This patch fixes the following checkpatch.pl issues caused by the new
> function: ether_addr_copy
> 
> Signed-off-by: Joel Pelaez Jorge <joelpelaez@gmail.com>
> ---
> diff --git a/drivers/staging/slicoss/slicoss.c
> b/drivers/staging/slicoss/slicoss.c
> index 12aafe3..4ff39aa 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -2313,7 +2313,7 @@ static int slic_mcast_add_list(struct adapter
> *adapter, char *address)
>       if (mcaddr == NULL)
>           return 1;
> 
> -    memcpy(mcaddr->address, address, ETH_ALEN);
> +    ether_addr_copy(mcaddr->address, address);

In addition to this, there are the same cases like this,
in this file as below. Please search other same cases.
For instance, 'grep' will be a good way to find it.

static void slic_adapter_set_hwaddr(struct adapter *adapter)
{
        struct sliccard *card = adapter->card;

        if ((adapter->card) && (card->config_set)) {
                memcpy(adapter->macaddr,
                       card->config.MacInfo[adapter->functionnumber].macaddrA,
                       sizeof(struct slic_config_mac));
                if (is_zero_ether_addr(adapter->currmacaddr))
                        memcpy(adapter->currmacaddr, adapter->macaddr,
                               ETH_ALEN);
                if (adapter->netdev)
                        memcpy(adapter->netdev->dev_addr, adapter->currmacaddr,
                               ETH_ALEN);
        }
}

Joe Perches,
These are not spotted by checkpatch.pl.
However, after modifying it as below, checkpatch warnings are
printed. Would you confirm it?

	if (is_zero_ether_addr(adapter->currmacaddr))
		memcpy(adapter->currmacaddr, adapter->macaddr, ETH_ALEN);
	if (adapter->netdev)
		memcpy(adapter->netdev->dev_addr, adapter->currmacaddr, ETH_ALEN);
	}


Best regards,
Jingoo Han


> 
>       mcaddr->next = adapter->mcastaddrs;
>       adapter->mcastaddrs = mcaddr;


  reply	other threads:[~2014-03-18  3:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18  3:17 Joel Pelaez Jorge
2014-03-18  3:38 ` Jingoo Han [this message]
2014-03-18  3:48   ` Joe Perches
2014-03-18 20:06 ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2014-03-18  5:04 Joel Pelaez Jorge
2014-03-18  5:49 ` Jingoo Han
2014-03-18 23:08   ` Joel Pelaez Jorge
2014-03-18  1:32 Joel Peláez Jorge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002401cf425b$7d1db5f0$775921d0$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=joelpelaez@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.p.waskiewicz.jr@intel.com \
    --cc=rashika.kheria@gmail.com \
    --cc=yongjun_wei@trendmicro.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®