From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753602AbbIHUkm (ORCPT ); Tue, 8 Sep 2015 16:40:42 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:54748 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752988AbbIHUkk (ORCPT ); Tue, 8 Sep 2015 16:40:40 -0400 Date: Tue, 08 Sep 2015 13:40:39 -0700 (PDT) Message-Id: <20150908.134039.343467168113066960.davem@davemloft.net> To: julien.grall@citrix.com Cc: jeremy.linton@arm.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, netdev@vger.kernel.org Subject: Re: [PATCH] device property: Don't overwrite addr when failing in device_get_mac_address From: David Miller In-Reply-To: <1441321190-25631-1-git-send-email-julien.grall@citrix.com> References: <1441321190-25631-1-git-send-email-julien.grall@citrix.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 08 Sep 2015 13:40:39 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julien Grall Date: Thu, 3 Sep 2015 23:59:50 +0100 > The function device_get_mac_address is trying different property names > in order to get the mac address. To check the return value, the variable > addr (which contain the buffer pass by the caller) will be re-used. This > means that if the previous property is not found, the next property will > be read using a NULL buffer. > > Therefore it's only possible to retrieve the mac if node contains a > property "mac-address". Fix it by using a temporary buffer for the > return value. > > This has been introduced by commit 4c96b7dc0d393f12c17e0d81db15aa4a820a6ab3 > "Add a matching set of device_ functions for determining mac/phy" > > Signed-off-by: Julien Grall Applied, thanks.