Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347AbbDQBEq (ORCPT ); Thu, 16 Apr 2015 21:04:46 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:38061 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751486AbbDQBEk (ORCPT ); Thu, 16 Apr 2015 21:04:40 -0400 Message-ID: <55305C31.4060104@oracle.com> Date: Fri, 17 Apr 2015 09:04:49 +0800 From: Zhenzhong Duan Reply-To: zhenzhong.duan@oracle.com Organization: Oracle User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jean Delvare CC: LKML , Ben Hutchings , Artem Savkov , Ivan Khoronzhuk , Matt Fleming Subject: Re: [PATCH] firmware: dmi_scan: Fix ordering of product_uuid References: <20150415110222.194867c1@endymion.delvare> <552F5535.9010302@oracle.com> <1429168164.4386.12.camel@chaos.site> <552F76E6.8030104@oracle.com> <1429176638.4386.19.camel@chaos.site> In-Reply-To: <1429176638.4386.19.camel@chaos.site> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1618 Lines: 41 在 2015/4/16 17:30, Jean Delvare 写道: > Le Thursday 16 April 2015 à 16:46 +0800, Zhenzhong Duan a écrit : >> On 2015/4/16 15:09, Jean Delvare wrote: >>> Le Thursday 16 April 2015 à 14:22 +0800, Zhenzhong Duan a écrit : >>>> The basic idea is right, but you ignore the case dmi_walk_early may >>>> fail, though looks impossible when bootup. >>>> >>>> Better to add below for robust. >>>> >>>> @@ -521,6 +521,6 @@ static int __init dmi_present(const u8 * >>>> >>>> return 0; >>>> } >>>> } >>>> + dmi_ver = 0; >>>> return 1; >>>> } >>>> >>> What is the value of this? dmi_ver will never be accessed after this >>> point anyway, as far as I can see. >> Same as above, future commit may not realize you bring this faulty when >> they want to use dmi_ver. > Why do you think this is "faulty"? The value in dmi_ver is correct > whether dmi_walk_early() succeeded or not. There's no rationale for > resetting dmi_ver on error and not dmi_num, dmi_len and dmi_base. Note > that dmi_smbios3_present() doesn't reset any of these either. These > values are all correct. > > If other modules need to check whether DMI was successfully initialized, > they must check dmi_available rather than any of the variables above > (which are all static anyway.) You are right, dmi_available should be used here. Sorry for noise zduan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/