lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <002401cf425b$7d1db5f0$775921d0$%han@samsung.com>
Date:	Tue, 18 Mar 2014 12:38:12 +0900
From:	Jingoo Han <jg1.han@...sung.com>
To:	'Joel Pelaez Jorge' <joelpelaez@...il.com>
Cc:	'Greg Kroah-Hartman' <gregkh@...uxfoundation.org>,
	'Joe Perches' <joe@...ches.com>,
	'Rashika Kheria' <rashika.kheria@...il.com>,
	'Peter P Waskiewicz Jr' <peter.p.waskiewicz.jr@...el.com>,
	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
	'Wei Yongjun' <yongjun_wei@...ndmicro.com.cn>,
	'Dan Carpenter' <dan.carpenter@...cle.com>,
	'Jingoo Han' <jg1.han@...sung.com>
Subject: Re: [PATCH] staging: slicoss: Fix prefer ether_addr_copy over memcpy

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@...il.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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ