Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1668600ybj; Fri, 20 Sep 2019 14:28:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4g6fMg/RkZvk4x9uxcKzSaRf7SHZJSWEeCGbi+XkphIjo+lZbukVr9tmNA6bkhwZWlZvG X-Received: by 2002:a50:ed17:: with SMTP id j23mr16019180eds.248.1569014937890; Fri, 20 Sep 2019 14:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569014937; cv=none; d=google.com; s=arc-20160816; b=j4fWbmY+wGlqsR/YLCAEauWOV7+atnn0t9CqfSj1h4/qJMHs3npL/5GJQ8osc7FYHv V4P4f/l5hHdJlNIRFBtSt8Pk6800sFH1UhDgaZTHMSevjnDkfei8Hxo3vAKC+h52yZSz F+VbWTfIiOM0+SS8ek18dgiqnqTMTfy2Da/33HM7QIAMfLVMCuU85RxnxjggXJq8bsvr q8RKPQQsWJ6OPWtdZ4vwojwS5mn5ghyiEpmgxcM4W4A9pMxIsX6NamCImZsLzC0FsGDz KOda+RDMpqydgeBrZD6VtwZqKWPTzXwbFWoXm3awCvApikL0dMxHK2UlDpS+x1AiRJ6k Xg0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=m2Vzh31IaPWokcYuuaY73I+XWtLcIDZaHZP8JOZPRT8=; b=LFriw9haW4jMJvr1jCfFKNdgZCzcmS2MX5IXr7C2D9ElPy5pZ6zt89182RKVs4bTeK qOUXvuGXiXA7HAYqx2lKRD2MBnsM7zNctbrfAuJoXju2Jcy2xMkCKWbhY8lrwwhss5fN ERJ8rAb1KpRxTMS4m5QQQzjzLC1TuamB1rOoxlnGh1VJMTXPZxRZHgYpdKyrISFMczip 7QDNBcFP2/s/8pQrnBY8CAtcqB5dnJx79bHLtMRvToLPGSod6xb0XtADzNfy8MNpQx+s TXsG7KmOuQd4ecmN0yhlZI+QiOxwx/qgz3thfJW8gqWmFLtMGd50w2PMfyMEAJNTHfX1 0ZzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ns21si1694977ejb.167.2019.09.20.14.28.34; Fri, 20 Sep 2019 14:28:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393818AbfITAcG (ORCPT + 99 others); Thu, 19 Sep 2019 20:32:06 -0400 Received: from linux.microsoft.com ([13.77.154.182]:33192 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391700AbfITAcG (ORCPT ); Thu, 19 Sep 2019 20:32:06 -0400 Received: from [10.200.157.35] (unknown [131.107.174.35]) by linux.microsoft.com (Postfix) with ESMTPSA id 021A920B718D; Thu, 19 Sep 2019 17:32:04 -0700 (PDT) Subject: Re: [RFC PATCH v1 1/1] Add support for arm64 to carry ima measurement log in kexec_file_load To: Thiago Jung Bauermann , Mimi Zohar Cc: mark.rutland@arm.com, jean-philippe@linaro.org, arnd@arndb.de, takahiro.akashi@linaro.org, sboyd@kernel.org, catalin.marinas@arm.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, kristina.martsenko@arm.org, duwe@lst.de, allison@lohutok.net, james.morse@arm.org, linux-integrity@vger.kernel.org, tglx@linutronix.de, linux-arm-kernel@lists.infradead.org References: <20190913225009.3406-1-prsriva@linux.microsoft.com> <20190913225009.3406-2-prsriva@linux.microsoft.com> <1568816111.16709.68.camel@linux.ibm.com> <1568841696.4733.3.camel@linux.ibm.com> <871rwd2ay8.fsf@morokweng.localdomain> From: Prakhar Srivastava Message-ID: Date: Thu, 19 Sep 2019 17:32:04 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <871rwd2ay8.fsf@morokweng.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/18/2019 8:59 PM, Thiago Jung Bauermann wrote: > Mimi Zohar writes: > >> On Wed, 2019-09-18 at 10:15 -0400, Mimi Zohar wrote: >> >>>> + uint64_t tmp_start, tmp_end; >>>> + >>>> + propStart = of_find_property(of_chosen, "linux,ima-kexec-buffer", >>>> + NULL); >>>> + if (propStart) { >>>> + tmp_start = fdt64_to_cpu(*((const fdt64_t *) propStart)); >>>> + ret = of_remove_property(of_chosen, propStart); >>>> + if (!ret) { >>>> + return ret; >>>> + } >>>> + >>>> + propEnd = of_find_property(of_chosen, >>>> + "linux,ima-kexec-buffer-end", NULL); >>>> + if (!propEnd) { >>>> + return -EINVAL; >>>> + } >>>> + >>>> + tmp_end = fdt64_to_cpu(*((const fdt64_t *) propEnd)); >>>> + >>>> + ret = of_remove_property(of_chosen, propEnd); >>>> + if (!ret) { >>>> + return ret; >>>> + } >>> There seems to be quite a bit of code duplication in this function and >>> in ima_get_kexec_buffer(). It could probably be cleaned up with some >>> refactoring. >> Sorry, my mistake. One calls of_get_property(), while the other calls >> of_find_property(). > of_get_property() is a thin wrapper around of_find_property(), so if > that's the only difference I think they can still be merged. I will move to using of_get_property and see if i can reduce the code further. Also address other comments by Mimi in my next iteration. Thanks, Prakhar Srivastava