From patchwork Thu Oct 17 10:05:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Polyakov X-Patchwork-Id: 1178442 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46v4Ym1Jd4z9sPF for ; Thu, 17 Oct 2019 21:06:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=yadro.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=yadro.com header.i=@yadro.com header.b="FQH3Ul9r"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46v4Yl71XHzDqKX for ; Thu, 17 Oct 2019 21:06:03 +1100 (AEDT) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=yadro.com (client-ip=89.207.88.252; helo=mta-01.yadro.com; envelope-from=m.polyakov@yadro.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=yadro.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=yadro.com header.i=@yadro.com header.b="FQH3Ul9r"; dkim-atps=neutral Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46v4YW62mFzDqS9 for ; Thu, 17 Oct 2019 21:05:51 +1100 (AEDT) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id CF99D43130; Thu, 17 Oct 2019 10:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= user-agent:content-disposition:content-type:content-type :mime-version:message-id:subject:subject:from:from:date:date :received:received:received; s=mta-01; t=1571306747; x= 1573121148; bh=yhvXsZ5OOwT2BXYkoaS4+rxznVRxfi2xEL+gGTM2TEo=; b=F QH3Ul9rUoIM9FltZREgCJDLZ6UCgk9sL1SyZof9wTS+DS9juvieKKr0bWxEUjPVz 5vfo206lNYmPlPdu3HXfdQQI4kjOK+yhPPlc2qQQ3S7FL13RjwmzbcIvmsGOxfAo xlUbQ5oVbmGYGih1kq1/OhM35PFm6n2nqdfbOPnTiI= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 97WMvSWagIHv; Thu, 17 Oct 2019 13:05:47 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id DDEE442F14; Thu, 17 Oct 2019 13:05:47 +0300 (MSK) Received: from localhost (172.17.15.1) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 17 Oct 2019 13:05:47 +0300 Date: Thu, 17 Oct 2019 13:05:47 +0300 From: Maxim Polyakov To: Jeremy Kerr , , Maxim Polyakov Subject: [PATCH v3 3/5] discover/platform-powerpc: return the actual mailbox size Message-ID: <20191017100545.GA6683@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [172.17.15.1] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" get_ipmi_boot_mailbox_block() should return the actual size of the received IPMI mailbox data Signed-off-by: Maxim Polyakov --- discover/platform-powerpc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index 1e33bf1..c874560 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -473,12 +473,7 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform, return -1; } - if (resp_len == 4) { - pb_debug_fn("block %hu empty\n", block); - return 0; - } - - blocksize = sizeof(resp) - 4; + blocksize = resp_len - 4; pb_debug_fn("Mailbox block %hu returns only %zu bytes in block\n", block, blocksize); @@ -512,6 +507,12 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform, return -1; } + if (!blocksize) { + pb_debug_fn("block %hu empty\n", block); + return 0; + } + + memcpy(buf, &resp[4], blocksize); return blocksize;