Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3105624ybk; Mon, 18 May 2020 18:11:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgJGCV7IwvU2th2bOKzlmW3sAE016+z9oObFltlpODjnSNB036LU0XG2bF4YxaHdQEhUil X-Received: by 2002:aa7:dd0a:: with SMTP id i10mr15172516edv.291.1589850682774; Mon, 18 May 2020 18:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589850682; cv=none; d=google.com; s=arc-20160816; b=CKhDp6S11Hhn4DwkwSJhhcxZsypj436fRi6kkox4U+gOjKczguyV7s6mv39um+ycS0 FAhrdFmTx9s9uViK+v8SEsgWgux19GKZ/g2eWW+zWqwoc7DuFX+ypy21aw/jXYDJc17x 9gQ+p7g2qQMqo1wicwNEhLotw8H3Gwt/KLG4JG2Pt2yAmmnzsfLXshnTxUWSp+p9lyMQ 89XXAfK05uWMD4m0uOZwKsBJdMjrsRgqX/FhOxs6iLXmNV+aN7Xi+rMY2JJgHsmbq5V5 aqqVJzgOOdHe4D7RGBp0+Kb9qaS54DUX9p5WSE9BgpnrzT6tpIaebRrBHLjKBjzHFSAA GHiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=MYmW06Kh9vq+i07Bkyz7H+ANSn5HdvqlksgD/s2kHNs=; b=J+hldLFrVMqUqFg453u2H2QXdO4PK7/EUB4tH2zykETgg3w0/Msq9Oeide70FGAIch jUXcRlFSUF4ava0FeiZ+hqPqh4cc0wrz2fAjewkDyY1D6lqw3c/WtD1RYWl4p20JCGTS nwumbTxBxYv7yk+wNAtBoh+OHTg5I0RE7FUFi/qmA//caLA0xQgxsn9ofh/hoIjc1xIn 9wfyRLw+RYF6tCWBpd8XDrTYVmxjnsNEG+Dp1ob1Wm5lj4tQrR0dPwM+WFgAOgzbVFPu T/kZvQqvV8VCmAgv//EUJRX8oea2c9x05c8yD6z48DdL2Crh2KvCpIGymdmH6NZ/18zI xHoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ozlabs.org header.s=201707 header.b=PjBgUvGm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ozlabs.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl8si7236016ejb.149.2020.05.18.18.11.00; Mon, 18 May 2020 18:11:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ozlabs.org header.s=201707 header.b=PjBgUvGm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ozlabs.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727922AbgESBHj (ORCPT + 99 others); Mon, 18 May 2020 21:07:39 -0400 Received: from ozlabs.org ([203.11.71.1]:39671 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbgESBHj (ORCPT ); Mon, 18 May 2020 21:07:39 -0400 Received: by ozlabs.org (Postfix, from userid 1023) id 49QyRF0gcQz9sTT; Tue, 19 May 2020 11:07:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1589850457; bh=/ckANuUqu3gyx20H5W9aJipVsE8n+HFMzdiIK207svE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PjBgUvGm0ESUu1SWVNI0mfNWV30lA4kJ1o1w2yRcKglraMF2wAqCNXhWb7JCQOWET PVo03rjfEE+WF4cP+wj9jcEmSzXGwnGA+RuOun/HGnYIkjb5JLgbz8sGs1uIipHVUW DUhowF+WRXiXTQq+sdVFuV4vbj7S56QFi3xXc7SiL6K7zre7cHU6zFkWWfq4ZTWS1+ NsypY/n3szCW0SdEicB9ZOj1R771Vo0HN/c3P0CLanDQGsm9bs5P00U/ILPopZHKpQ 8G3uQNQmc+2cfmoE1IUrkq4Hw+DdrS0m+Gm3Ad/pRZ5kjoRhJwF/LlgdawO8X0qaHM 2eY7RXnAp+jFw== From: Jeremy Kerr To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Benjamin Herrenschmidt , Paul Mackerras , Finn Thain , Stan Johnson Subject: [PATCH] net: bmac: Fix read of MAC address from ROM Date: Tue, 19 May 2020 09:05:58 +0800 Message-Id: <20200519010558.24805-1-jk@ozlabs.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <4863b7d34cf23d269921ad133dc585ec83a0bb63.camel@ozlabs.org> References: <4863b7d34cf23d269921ad133dc585ec83a0bb63.camel@ozlabs.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In bmac_get_station_address, We're reading two bytes at a time from ROM, but we do that six times, resulting in 12 bytes of read & writes. This means we will write off the end of the six-byte destination buffer. This change fixes the for-loop to only read/write six bytes. Based on a proposed fix from Finn Thain . Signed-off-by: Jeremy Kerr Reported-by: Stan Johnson Tested-by: Stan Johnson Reported-by: Finn Thain --- drivers/net/ethernet/apple/bmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c index a58185b1d8bf..3e3711b60d01 100644 --- a/drivers/net/ethernet/apple/bmac.c +++ b/drivers/net/ethernet/apple/bmac.c @@ -1182,7 +1182,7 @@ bmac_get_station_address(struct net_device *dev, unsigned char *ea) int i; unsigned short data; - for (i = 0; i < 6; i++) + for (i = 0; i < 3; i++) { reset_and_select_srom(dev); data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits); -- 2.17.1