[{"id":1768912,"web_url":"http://patchwork.ozlabs.org/comment/1768912/","msgid":"<1505438482.2732.4.camel@gmail.com>","list_archive_url":null,"date":"2017-09-15T01:21:22","subject":"Re: [Skiboot] [SKIBOOT] [PATCH] pflash: Fix erase command for\n\tunaligned start address","submitter":{"id":64457,"url":"http://patchwork.ozlabs.org/api/people/64457/","name":"Cyril Bur","email":"cyrilbur@gmail.com"},"content":"On Wed, 2017-09-13 at 16:59 +1000, Suraj Jitindar Singh wrote:\n> The erase_range() function handles erasing the flash for a given start\n> address and length, and can handle an unaligned start address and\n> length. However in the unaligned start address case we are incorrectly\n> calculating the remaining size which can lead to incomplete erases.\n> \n> If we're going to update the remaining size based on what the start\n> address was then we probably want to do that before we overide the\n> origin start address. So rearrange the code so that this is indeed the\n> case.\n> \n> Reported-by: Pridhiviraj Paidipeddi <ppaidipe@in.ibm.com>\n> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>\n\nGood find.\nStewart: I know you usually do, but just to be sure, if you could\nrespond with the merged sha1 of this so that I'll remember to add a\ntestcase for this, I'm surprised this wasn't caught in testing.\n\nReviewed-by: Cyril Bur <cyril.bur@au1.ibm.com>\n\n> ---\n>  external/pflash/pflash.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c\n> index bfc975f..5b1be3c 100644\n> --- a/external/pflash/pflash.c\n> +++ b/external/pflash/pflash.c\n> @@ -331,9 +331,9 @@ static int erase_range(struct flash_details *flash,\n>  \t\t\tfprintf(stderr, \"Failed to blocklevel_smart_erase(): %d\\n\", rc);\n>  \t\t\treturn 1;\n>  \t\t}\n> -\t\tstart += flash->erase_granule - (start & erase_mask);\n>  \t\tsize -= flash->erase_granule - (start & erase_mask);\n>  \t\tdone = flash->erase_granule - (start & erase_mask);\n> +\t\tstart += flash->erase_granule - (start & erase_mask);\n>  \t}\n>  \tprogress_tick(done);\n>  \twhile (size & ~(erase_mask)) {","headers":{"Return-Path":"<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","skiboot@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","skiboot@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtd0D6Nl4z9t2V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 11:21:32 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xtd0D5CwMzDrWR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 11:21:32 +1000 (AEST)","from mail-pg0-x244.google.com (mail-pg0-x244.google.com\n\t[IPv6:2607:f8b0:400e:c05::244])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xtd075SYZzDrWD\n\tfor <skiboot@lists.ozlabs.org>; Fri, 15 Sep 2017 11:21:27 +1000 (AEST)","by mail-pg0-x244.google.com with SMTP id j16so511308pga.2\n\tfor <skiboot@lists.ozlabs.org>; Thu, 14 Sep 2017 18:21:27 -0700 (PDT)","from camb691.ozlabs.ibm.com ([122.99.82.10])\n\tby smtp.googlemail.com with ESMTPSA id\n\tf9sm2851226pfe.150.2017.09.14.18.21.23\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 14 Sep 2017 18:21:24 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"VJQQmoU6\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"VJQQmoU6\"; dkim-atps=neutral","ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400e:c05::244; helo=mail-pg0-x244.google.com;\n\tenvelope-from=cyrilbur@gmail.com; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"VJQQmoU6\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=message-id:subject:from:to:cc:date:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=uBGDMQP98tzFq44PfwSD1U+q2JYXOWiIvUgj8EfQS+I=;\n\tb=VJQQmoU6CmW73keTskXRekG6h8dtkhDg2PdMPgAgM9thDCWLZfVo0fgXxRD8npM6Bg\n\t8a1+u61+9UMGqGP89vPHtIXMJf5Kc7443IE3xn4AYngdo15n76zt5xJ4YtnAjIt25Uii\n\tNWZpGJhROZ5mxPbiYhkaseUpV5CthsU2EZcZZSRHT2rajwH4Q4Y1aOExXB4PMT3idCJb\n\tA33pMP4yfopHYkDZEwCGOWvGwn3WeBKl1lCbGH0cPR/7vJl32itC8oQ912t+2Gcxgihp\n\t0GkERUNpBuAEzibourf3rx9DNqpMD/7olUpW5u6Mq9CVYvpmCsFuM1lX54aPWpO0y+sX\n\tp2HA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=uBGDMQP98tzFq44PfwSD1U+q2JYXOWiIvUgj8EfQS+I=;\n\tb=tzeJ6VQz1j9VogwdaTdogXMwihJmi8PNLT+xNDJQ3v63tIYSDqgwprxrtoAY7xHHtu\n\tdYEfgwCM/uG9nuzTJsTI08TMYP0Qr8j5aRVcMCeuU83WYBhKjn3/X+xw9+eYlXIgXy2v\n\tnlFC5EGIngGxTL3eR0povaF3iJNfMfHrAqS96D42whrT2lC3qqvHUsKhh/noKzodrw0R\n\tAYSv6aIwzL9fm5bY+yHf2BleSJJ+VKnJGXIwrnuR5jh4C83nJP2k76AduFDFOX/SZp4A\n\tkkJJgU+7yyw4qle7ftte/pMue2PgCBKh8+u0xPuQO9MYRqb2v8FqPJ9DfoDHF+iUO/W8\n\tn8RA==","X-Gm-Message-State":"AHPjjUhlhmfOoZB63MDCP0zhEWrXirBJLL6+8V3kG9QwQ7VIX3cXGDJ+\n\tHl1xI77Q0aDI7w==","X-Google-Smtp-Source":"ADKCNb5dC2D6VEo+2sULWRqgVVr3v8WgVdHUYPqQClJ4Ib3pU9FwUs46hT6xNBr1bzaV6vOAkKELnA==","X-Received":"by 10.99.115.5 with SMTP id o5mr22876877pgc.225.1505438485696;\n\tThu, 14 Sep 2017 18:21:25 -0700 (PDT)","Message-ID":"<1505438482.2732.4.camel@gmail.com>","From":"Cyril Bur <cyrilbur@gmail.com>","To":"Suraj Jitindar Singh <sjitindarsingh@gmail.com>, skiboot@lists.ozlabs.org","Date":"Fri, 15 Sep 2017 11:21:22 +1000","In-Reply-To":"<20170913065946.11262-1-sjitindarsingh@gmail.com>","References":"<20170913065946.11262-1-sjitindarsingh@gmail.com>","X-Mailer":"Evolution 3.24.5 ","Mime-Version":"1.0","Subject":"Re: [Skiboot] [SKIBOOT] [PATCH] pflash: Fix erase command for\n\tunaligned start address","X-BeenThere":"skiboot@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Mailing list for skiboot development <skiboot.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/skiboot/>","List-Post":"<mailto:skiboot@lists.ozlabs.org>","List-Help":"<mailto:skiboot-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org","Sender":"\"Skiboot\"\n\t<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"}},{"id":1769026,"web_url":"http://patchwork.ozlabs.org/comment/1769026/","msgid":"<87shfoe5ny.fsf@linux.vnet.ibm.com>","list_archive_url":null,"date":"2017-09-15T08:18:25","subject":"Re: [Skiboot] [SKIBOOT] [PATCH] pflash: Fix erase command for\n\tunaligned start address","submitter":{"id":48041,"url":"http://patchwork.ozlabs.org/api/people/48041/","name":"Stewart Smith","email":"stewart@linux.vnet.ibm.com"},"content":"Cyril Bur <cyrilbur@gmail.com> writes:\n> On Wed, 2017-09-13 at 16:59 +1000, Suraj Jitindar Singh wrote:\n>> The erase_range() function handles erasing the flash for a given start\n>> address and length, and can handle an unaligned start address and\n>> length. However in the unaligned start address case we are incorrectly\n>> calculating the remaining size which can lead to incomplete erases.\n>> \n>> If we're going to update the remaining size based on what the start\n>> address was then we probably want to do that before we overide the\n>> origin start address. So rearrange the code so that this is indeed the\n>> case.\n>> \n>> Reported-by: Pridhiviraj Paidipeddi <ppaidipe@in.ibm.com>\n>> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>\n>\n> Good find.\n> Stewart: I know you usually do, but just to be sure, if you could\n> respond with the merged sha1 of this so that I'll remember to add a\n> testcase for this, I'm surprised this wasn't caught in testing.\n\nMerged as of aefd3ffce6ed8f586290c0044446024f6e6fdcd5\n\nMoar tests always welcomed. :)","headers":{"Return-Path":"<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","skiboot@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","skiboot@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtpFY0BNMz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 18:18:41 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xtpFX6L6bzDrWl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 18:18:40 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n\t[148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xtpFR3v8czDrW9\n\tfor <skiboot@lists.ozlabs.org>; Fri, 15 Sep 2017 18:18:35 +1000 (AEST)","from pps.filterd (m0098416.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8F8ENe5006149\n\tfor <skiboot@lists.ozlabs.org>; Fri, 15 Sep 2017 04:18:33 -0400","from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2d086bg1ge-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <skiboot@lists.ozlabs.org>; Fri, 15 Sep 2017 04:18:32 -0400","from localhost\n\tby e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <skiboot@lists.ozlabs.org> from <stewart@linux.vnet.ibm.com>;\n\tFri, 15 Sep 2017 02:18:32 -0600","from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19)\n\tby e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tFri, 15 Sep 2017 02:18:29 -0600","from b03ledav001.gho.boulder.ibm.com\n\t(b03ledav001.gho.boulder.ibm.com [9.17.130.232])\n\tby b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v8F8ISok65601700; Fri, 15 Sep 2017 01:18:28 -0700","from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 7EED36E03D;\n\tFri, 15 Sep 2017 02:18:28 -0600 (MDT)","from birb.localdomain (unknown [9.81.193.104])\n\tby b03ledav001.gho.boulder.ibm.com (Postfix) with SMTP id 9E4946E038; \n\tFri, 15 Sep 2017 02:18:27 -0600 (MDT)","by birb.localdomain (Postfix, from userid 1000)\n\tid EB8BD4EC741; Fri, 15 Sep 2017 18:18:25 +1000 (AEST)"],"Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com\n\t(client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com;\n\tenvelope-from=stewart@linux.vnet.ibm.com; receiver=<UNKNOWN>)","From":"Stewart Smith <stewart@linux.vnet.ibm.com>","To":"Cyril Bur <cyrilbur@gmail.com>,\n\tSuraj Jitindar Singh <sjitindarsingh@gmail.com>, skiboot@lists.ozlabs.org","In-Reply-To":"<1505438482.2732.4.camel@gmail.com>","References":"<20170913065946.11262-1-sjitindarsingh@gmail.com>\n\t<1505438482.2732.4.camel@gmail.com>","Date":"Fri, 15 Sep 2017 18:18:25 +1000","MIME-Version":"1.0","X-TM-AS-GCONF":"00","x-cbid":"17091508-0028-0000-0000-0000085C9CC5","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007740; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000227; SDB=6.00917289; UDB=6.00460708;\n\tIPR=6.00697517; \n\tBA=6.00005589; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017163;\n\tXFM=3.00000015; UTC=2017-09-15 08:18:30","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17091508-0029-0000-0000-0000378F6EF2","Message-Id":"<87shfoe5ny.fsf@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-15_03:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=1\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709150124","Subject":"Re: [Skiboot] [SKIBOOT] [PATCH] pflash: Fix erase command for\n\tunaligned start address","X-BeenThere":"skiboot@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Mailing list for skiboot development <skiboot.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/skiboot/>","List-Post":"<mailto:skiboot@lists.ozlabs.org>","List-Help":"<mailto:skiboot-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org","Sender":"\"Skiboot\"\n\t<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"}}]