From patchwork Wed Aug 17 05:32:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 659906 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sDdFz0PRLz9s3v for ; Wed, 17 Aug 2016 15:34:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=UI1UO+ST; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sDdFy6LdyzDr5V for ; Wed, 17 Aug 2016 15:34:30 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=UI1UO+ST; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sDdDv4prpzDr4h for ; Wed, 17 Aug 2016 15:33:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=UI1UO+ST; dkim-atps=neutral Received: by mail-pf0-x243.google.com with SMTP id i6so6915327pfe.0 for ; Tue, 16 Aug 2016 22:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B2nrfvMKjmcfS7I5Sw7zpPJPYx6U8N6G03cdGn1C3ao=; b=UI1UO+STJcQbhWdkhQc09W6RzmXwRE3gIMq+r6e5tQY0PLv0uUNb/nhOCr+Xs+/idQ ZHZZXEkAMkzar+CQ4dUsFkJb8xvYzsN99aRJLKnrjJL3SPBqBCeXeOUe+znr1B/kmKiG DTg0vdmjaQ3Hgn5O23xjFQh1iVRnDRlVgfRxUJ7axlUEU1LRbcQD260cz+qmCzQlJVt5 OQ5gzim+shvSvVmEWF6F2xqgXpeHpnXyneOW0qSmZAliJtVKdxHfDBXru5vzyrc1KDOe EzCQpaTDf4biPnIf9tpbObp67PVrufZzW4qen9BlDVJMUnTcDV78WE4hY/xJTiFPNwN0 wuCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B2nrfvMKjmcfS7I5Sw7zpPJPYx6U8N6G03cdGn1C3ao=; b=ADr72jRQgHqnMN1rZ84hu1MhQuo7qfKU3U2s1DnB60OO8jPdHaRItN7VkGI55hlOaH npz2xJFDZfHoVyVb/d/2N6gnS3hU3NEcMe+/S74x6R2FLy/Meve0CDMRrktHtkYWxQ7B tSQZbke4KaGhxfi4aMgvJI7AOxSw8Xm8zFnSsQ6ldnPfNaJ7SMasc+ytlOldrk9eFNfE KsUBhvBS5DeDxPnTTjyAHuO8pirGJlgi7dJKUXuZseFClRNgnNeQIXg5fmHYZ08Wh9x2 2omoNOoLlOn3iBo7ylZ43WVLLtv1mNXy/zqnFS0hoUeVjiBqV9NegHLRwB0A4BOfhKUc aH0g== X-Gm-Message-State: AEkoouse1HJL6h+5Gx0uGD5T6x37lwEs6PSexaalc/c1ga7yvi76+DBoCIhWNrZBWmOKoA== X-Received: by 10.98.70.8 with SMTP id t8mr2717219pfa.36.1471412014110; Tue, 16 Aug 2016 22:33:34 -0700 (PDT) Received: from canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id p75sm43376027pfa.71.2016.08.16.22.33.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Aug 2016 22:33:33 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Wed, 17 Aug 2016 15:32:53 +1000 Message-Id: <1471411974-8179-7-git-send-email-oohall@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1471411974-8179-1-git-send-email-oohall@gmail.com> References: <1471411974-8179-1-git-send-email-oohall@gmail.com> Subject: [Skiboot] [PATCH v2 6/7] core/test: add test for nul check in nvram_format() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Adds a test for nvram_check() that the ibm,skiboot nvram partition is correctly terminated. Signed-off-by: Oliver O'Halloran --- core/test/run-nvram-format.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/test/run-nvram-format.c b/core/test/run-nvram-format.c index 2d0c2da56ace..b8ba69867c77 100644 --- a/core/test/run-nvram-format.c +++ b/core/test/run-nvram-format.c @@ -65,6 +65,12 @@ int main(void) nvram_image[0] = 0; assert(nvram_check(nvram_image,128*1024) != 0); + /* Does our NUL checking work? */ + assert(nvram_format(nvram_image, 128 * 1024) == 0); + h = (struct chrp_nvram_hdr *) nvram_image; + memset((char *) h + sizeof(*h), 0xFF, h->len * 16 - sizeof(*h)); + assert(nvram_check(nvram_image, 128 * 1024) != 0); + assert(nvram_format(nvram_image, 128*1024)==0); /* corrupt the length of the partition */ nvram_image[2] = 0;