From patchwork Wed Jun 26 12:36:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Polyakov X-Patchwork-Id: 1123041 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 45YyrR157pz9s3C for ; Thu, 27 Jun 2019 08:49:11 +1000 (AEST) 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="S4Xv2FWf"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45YyrR0DGqzDqXl for ; Thu, 27 Jun 2019 08:49:11 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) 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="S4Xv2FWf"; 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 45YjG11w4xzDqWh for ; Wed, 26 Jun 2019 22:36:57 +1000 (AEST) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id E899841949 for ; Wed, 26 Jun 2019 12:36:52 +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=1561552611; x= 1563367012; bh=yhvXsZ5OOwT2BXYkoaS4+rxznVRxfi2xEL+gGTM2TEo=; b=S 4Xv2FWfni7hjvEoHIVzbB4Dmv5Wgm8dY1sEq+LZgW4TXVruMMFvm5GuS4QZxgA8L /qkI+DTtAZ6zjLid6Eh5qKhmdpcEe2wkleQLWhO2xLxd4GeIuTdh38MM5aoEflSs XtRhj8aVXu/5c+NOM6J5p4ct23OfkUU4+boNENSYL0= 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 qN2ee43KUmlG for ; Wed, 26 Jun 2019 15:36:51 +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 E823641940 for ; Wed, 26 Jun 2019 15:36:51 +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; Wed, 26 Jun 2019 15:36:51 +0300 Date: Wed, 26 Jun 2019 15:36:51 +0300 From: Maxim Polyakov To: Subject: [PATCH 3/5] discover/platform-powerpc: return the actual mailbox size Message-ID: <20190626123650.GA16678@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-Mailman-Approved-At: Thu, 27 Jun 2019 08:48:55 +1000 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;