mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Quytelda Kahja <quytelda@tamalin.org>
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	driverdev-devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org, wsa@the-dreams.de
Subject: Re: [PATCH v2 68/75] staging: ks7010: Replace manual array copy with ether_addr_copy().
Date: Sat, 31 Mar 2018 12:14:20 +0300	[thread overview]
Message-ID: <20180331091420.3gdpzy557j2g443d@mwanda> (raw)
In-Reply-To: <20180331060855.9452-68-quytelda@tamalin.org>

I'm in a hurry because I'm leaving for a long weekend so I've reviewed
the first easy 67 patches but this one is tricky and I'm not able to
review it properly before I leave.

On Fri, Mar 30, 2018 at 11:08:48PM -0700, Quytelda Kahja wrote:
> Copying the dummy HW address into the struct net_device doesn't need
> to be done byte by byte; use ether_addr_copy() instead.

Fine.

> Additionally, dev->dev_addr is not eight bytes long.
> ether_setup() sets the dev->addr_len to ETH_ALEN (defined as 6)
> in the net core code.

So it's a buffer overflow?  The subject should have mentioned that this
is a bug fix.  But I'm not sure it is.  dev->dev_addr is MAX_ADDR_LEN (32)
bytes long I believe.  See dev_addr_init() for details.

The commit message didn't make it clear that you were getting rid of
priv->eth_addr.  It's a good change, but it confused me and I am in a
hurry.

> 
> Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
> ---
>  drivers/staging/ks7010/ks_hostif.c   | 29 +++++++++++------------------
>  drivers/staging/ks7010/ks_wlan.h     |  2 --
>  drivers/staging/ks7010/ks_wlan_net.c | 13 ++-----------
>  3 files changed, 13 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c
> index 1eff78540683..23c637ef147d 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -388,6 +388,7 @@ int hostif_data_indication_wpa(struct ks_wlan_private *priv,
>  static
>  void hostif_data_indication(struct ks_wlan_private *priv)
>  {
> +	struct net_device *dev = priv->net_dev;
>  	unsigned int rx_ind_size;	/* indicate data size */
>  	struct sk_buff *skb;
>  	unsigned short auth_type;
> @@ -411,9 +412,9 @@ void hostif_data_indication(struct ks_wlan_private *priv)
>  	eth_proto = ntohs(eth_hdr->h_proto);
>  
>  	/* source address check */
> -	if (memcmp(&priv->eth_addr[0], eth_hdr->h_source, ETH_ALEN) == 0) {
> -		netdev_err(priv->net_dev, "invalid : source is own mac address !!\n");
> -		netdev_err(priv->net_dev,
> +	if (memcmp(dev->dev_addr, eth_hdr->h_source, ETH_ALEN) == 0) {
> +		netdev_err(dev, "invalid : source is own mac address !!\n");
> +		netdev_err(dev,
>  			   "eth_hdrernet->h_dest=%02X:%02X:%02X:%02X:%02X:%02X\n",
>  			   eth_hdr->h_source[0], eth_hdr->h_source[1],
>  			   eth_hdr->h_source[2], eth_hdr->h_source[3],
> @@ -443,7 +444,7 @@ void hostif_data_indication(struct ks_wlan_private *priv)
>  			priv->nstats.rx_dropped++;
>  			return;
>  		}
> -		netdev_dbg(priv->net_dev, "SNAP, rx_ind_size = %d\n",
> +		netdev_dbg(dev, "SNAP, rx_ind_size = %d\n",
>  			   rx_ind_size);

I don't like the printk cleanups.  They belong in a separate patch and
they make it harder for reviewers in a hurry to see what the patch is
doing.

Sorry, gotta run...

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  reply	other threads:[~2018-03-31  9:14 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAFLvi23=E6QubTGX0=cHjbJGB=Vx5OJ7d16E2R4HZTscmJuuSw@mail.gmail.com>
2018-03-31  6:07 ` [PATCH v2 01/75] staging: ks7010: Use the ARRAY_SIZE() macro to calculate array sizes Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 02/75] staging: ks7010: Remove trailing _t from 'struct wpa_suite_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 03/75] staging: ks7010: Remove trailing _t from 'struct rsn_mode_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 04/75] staging: ks7010: Remove trailing _t from 'struct pmk_cache_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 05/75] staging: ks7010: Remove trailing _t from 'struct hostif_data_request_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 06/75] staging: ks7010: Remove unused 'struct hostif_data_indication_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 07/75] staging: ks7010: Remove trailing _t from 'struct channel_list_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 08/75] staging: ks7010: Remove trailing _t from 'struct hostif_mib_get_request_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 09/75] staging: ks7010: Remove trailing _t from 'struct hostif_mib_value_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 10/75] staging: ks7010: Remove unused 'struct hostif_mib_get_confirm_t' Quytelda Kahja
2018-04-23 12:13     ` Greg KH
2018-03-31  6:07   ` [PATCH v2 11/75] staging: ks7010: Remove trailing _t from 'struct hostif_mib_set_request_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 12/75] staging: ks7010: Remove unused 'struct hostif_mib_set_confirm_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 13/75] staging: ks7010: Remove trailing _t from 'struct hostif_power_mgmt_request_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 14/75] staging: ks7010: Remove unused 'struct hostif_power_mgmt_confirm_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 15/75] staging: ks7010: Remove trailing _t from 'struct hostif_start_request_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 16/75] staging: ks7010: Remove unused 'struct hostif_start_confirm_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 17/75] staging: ks7010: Remove trailing _t from 'struct ssid_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 18/75] staging: ks7010: Remove trailing _t from 'struct rate_set8_t' Quytelda Kahja
2018-03-31  6:07   ` [PATCH v2 19/75] staging: ks7010: Remove trailing _t from 'struct fh_parms_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 20/75] staging: ks7010: Remove trailing _t from 'struct ds_parms_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 21/75] staging: ks7010: Remove trailing _t from 'struct cf_parms_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 22/75] staging: ks7010: Remove trailing _t from 'struct ibss_parms_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 23/75] staging: ks7010: Remove unused 'struct rsn_t' Quytelda Kahja
2018-04-23 12:14     ` Greg KH
2018-03-31  6:08   ` [PATCH v2 24/75] staging: ks7010: Remove trailing _t from 'struct erp_params_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 25/75] staging: ks7010: Remove trailing _t from 'struct rate_set16_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 26/75] staging: ks7010: Remove trailing _t from 'struct ap_info_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 27/75] staging: ks7010: Remove trailing _t from 'struct link_ap_info_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 28/75] staging: ks7010: Remove unused 'struct hostif_connect_indication_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 29/75] staging: ks7010: Remove trailing _t from 'struct hostif_stop_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 30/75] staging: ks7010: Remove unused 'struct hostif_stop_confirm_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 31/75] staging: ks7010: Remove trailing _t from 'struct hostif_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 32/75] staging: ks7010: Remove trailing _t from 'struct hostif_ps_adhoc_set_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 33/75] staging: ks7010: Remove unused 'struct hostif_ps_adhoc_set_confirm_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 34/75] staging: ks7010: Remove trailing _t from 'struct hostif_infrastructure_set_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 35/75] staging: ks7010: Remove unused 'struct hostif_infrastructure_set_confirm_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 36/75] staging: ks7010: Remove trailing _t from 'struct hostif_adhoc_set_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 37/75] staging: ks7010: Remove trailing _t from 'struct hostif_adhoc_set2_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 38/75] staging: ks7010: Remove unused 'struct hostif_adhoc_set_confirm_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 39/75] staging: ks7010: Remove unused 'struct last_associate_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 40/75] staging: ks7010: Remove trailing _t from 'struct association_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 41/75] staging: ks7010: Remove trailing _t from 'struct association_response_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 42/75] staging: ks7010: Remove unused 'struct hostif_associate_indication_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 43/75] staging: ks7010: Remove trailing _t from 'struct hostif_bss_scan_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 44/75] staging: ks7010: Remove unused 'struct hostif_bss_scan_confirm_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 45/75] staging: ks7010: Remove trailing _t from 'struct hostif_phy_information_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 46/75] staging: ks7010: Remove unused 'struct hostif_phy_information_confirm_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 47/75] staging: ks7010: Remove trailing _t from 'struct hostif_sleep_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 48/75] staging: ks7010: Remove unused 'struct hostif_sleep_confirm_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 49/75] staging: ks7010: Remove trailing _t from 'struct hostif_mic_failure_request_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 50/75] staging: ks7010: Remove unused 'struct hostif_mic_failure_confirm_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 51/75] staging: ks7010: Remove trailing _t from 'struct hostt_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 52/75] staging: ks7010: Remove trailing _t from 'struct rsn_ie_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 53/75] staging: ks7010: Remove trailing _t from 'struct wps_ie_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 54/75] staging: ks7010: Remove trailing _t from 'struct local_ap_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 55/75] staging: ks7010: Remove trailing _t from 'struct local_aplist_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 56/75] staging: ks7010: Remove trailing _t from 'struct local_gain_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 57/75] staging: ks7010: Remove trailing _t from 'struct local_eeprom_sum_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 58/75] staging: ks7010: Remove trailing _t from 'struct power_save_status_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 59/75] staging: ks7010: Remove trailing _t from 'struct sleep_status_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 60/75] staging: ks7010: Remove trailing _t from 'struct scan_ext_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 61/75] staging: ks7010: Remove trailing _t from 'struct wpa_key_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 62/75] staging: ks7010: Remove trailing _t from 'struct mic_failure_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 63/75] staging: ks7010: Remove trailing _t from 'struct wpa_status_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 64/75] staging: ks7010: Remove trailing _t from 'struct pmk_list_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 65/75] staging: ks7010: Remove trailing _t from 'struct pmk_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 66/75] staging: ks7010: Remove trailing _t from 'struct wps_status_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 67/75] staging: ks7010: Remove trailing _t from 'struct michael_mic_t' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 68/75] staging: ks7010: Replace manual array copy with ether_addr_copy() Quytelda Kahja
2018-03-31  9:14     ` Dan Carpenter [this message]
2018-03-31  6:08   ` [PATCH v2 69/75] staging: ks7010: Remove extra blank line between functions Quytelda Kahja
2018-03-31  8:43     ` Dan Carpenter
2018-03-31  6:08   ` [PATCH v2 70/75] staging: ks7010: Rename ks_wlan_set_multicast_list() Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 71/75] staging: ks7010: Remove dummy address set Quytelda Kahja
2018-03-31  8:46     ` Dan Carpenter
2018-04-03  1:43       ` Dan Carpenter
2018-03-31  6:08   ` [PATCH v2 72/75] staging: ks7010: Change 'device_open_status' to a bool Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 73/75] staging: ks7010: Remove unnecessary casts in 'struct ks_wlan_handler_def' Quytelda Kahja
2018-03-31  6:08   ` [PATCH v2 74/75] staging: ks7010: Replace memcmp() with ether_addr_equal() Quytelda Kahja
2018-04-03  7:14     ` Dan Carpenter
2018-03-31  6:08   ` [PATCH v2 75/75] staging: ks7010: Replace memcpy() with ether_addr_copy() Quytelda Kahja
2018-04-23 12:20     ` Greg KH
2018-03-31  6:36   ` [PATCH v2 01/75] staging: ks7010: Use the ARRAY_SIZE() macro to calculate array sizes Joe Perches
2018-03-31  8:41     ` Dan Carpenter
2018-03-31 14:12       ` Joe Perches
2018-04-02 11:45         ` Dan Carpenter
2018-04-02 14:57           ` Joe Perches
2018-04-02 18:09             ` Quytelda Kahja
2018-04-03  7:17               ` Dan Carpenter

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=20180331091420.3gdpzy557j2g443d@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quytelda@tamalin.org \
    --cc=wsa@the-dreams.de \
    /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®