Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3157371imm; Sun, 1 Jul 2018 13:55:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeLlhqcB8BePCNDkvY3NuEKC+i8i3nEJwh3hhHhmboaE3FUCXfaBwCsqLergLvorc3PirBt X-Received: by 2002:a65:5d4c:: with SMTP id e12-v6mr12410266pgt.10.1530478516375; Sun, 01 Jul 2018 13:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530478516; cv=none; d=google.com; s=arc-20160816; b=S87ngBWhMF+TC+SMkbqGL7XZDlOyB8przKnNpN2i4H01wJB+sL1SFeAJNvCwkwr2YQ VvmkU4vN1hVt+WYVBYGoKy+oBKj3/dqcGgAfpO65GTG8Gpg35cEPvbLa/eiiwlZ2I0s8 gjptI5+d5xBzIEjDjWU5e+/faLbBcYrN+2ajfQBjrLXZ+ljfo89nzP4TwWaJwjnDGLh9 qgEhjnFoXGkvnqx4KFXm4eAt0srf0hhfARY4tXqca9xd/Uve9kcHZ/pQ+XdODxFIOwo/ kVVkyL4g3uut9zrvpSXzWgDqT4Zb90YoNwU6ivWnQbY2FWZDyGtUSgmHw5t74tIMgpLu 2Vww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=8XIz6dAJV0Q4z9vSqxZOCVYVZ8A3kCwS21QXQq5IppY=; b=ndd9MhZNVV3T/jbPd333Ot9FzXyzUlcyr9I8Ndp8WuC5+wrZTfUk0swwpr7C8VXq4U R0rzmuJPoW0zYh2RW6NuQaif5ZS1ArYtpL7PMxY466ckKdlW28CQe0/SAiiWar578H6k Of0Ej02A09tHLkDqi8z+kKDaWqV3FdWTOrL+l0rICTS4koPL5h4EPXawuJ2yOjLXpM5+ h1O6h8rPpqFqY+3B5DJKMqBuJ5VM6cQAQZAHt4JlxDnFoQq6EiQwAjbKyz1zImk5hPMi beV8Dm4qZy3jv/ILaBgULYEb9Bb/NiDqUiwmoQ9IY4LJ1B/h463mr8wAFjR/oylVwKP6 jsBQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c32-v6si14315331plj.277.2018.07.01.13.54.49; Sun, 01 Jul 2018 13:55:16 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752550AbeGAUup (ORCPT + 99 others); Sun, 1 Jul 2018 16:50:45 -0400 Received: from lithops.sigma-star.at ([195.201.40.130]:34566 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356AbeGAUun (ORCPT ); Sun, 1 Jul 2018 16:50:43 -0400 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 4FB6060A04C1; Sun, 1 Jul 2018 22:50:42 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id SKXoBf_hrVCQ; Sun, 1 Jul 2018 22:50:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id DE32060A04C3; Sun, 1 Jul 2018 22:50:41 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TM4829nv46gt; Sun, 1 Jul 2018 22:50:41 +0200 (CEST) Received: from blindfold.localnet (213-47-184-186.cable.dynamic.surfer.at [213.47.184.186]) by lithops.sigma-star.at (Postfix) with ESMTPSA id B73CD60A04C1; Sun, 1 Jul 2018 22:50:41 +0200 (CEST) From: Richard Weinberger To: Boris Brezillon Cc: Quentin Schulz , dedekind1@gmail.com, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com Subject: Re: [PATCH v3 2/2] ubi: expose the volume CRC check skip flag Date: Sun, 01 Jul 2018 22:50:41 +0200 Message-ID: <3709236.JAAyN4mQyL@blindfold> In-Reply-To: <20180701223347.2cef133b@bbrezillon> References: <382648641.QZzOm4Mo72@blindfold> <20180701223347.2cef133b@bbrezillon> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Sonntag, 1. Juli 2018, 22:33:47 CEST schrieb Boris Brezillon: > On Sun, 01 Jul 2018 21:35:57 +0200 > Richard Weinberger wrote: > > > Quentin, > > > > Am Donnerstag, 28. Juni 2018, 09:40:53 CEST schrieb Quentin Schulz: > > > Now that we have the logic for skipping CRC check for static UBI volumes > > > in the core, let's expose it to users. > > > > > > This makes use of a padding byte in the volume description data > > > structure as a flag. This flag only tell for now whether we should skip > > > the CRC check of a volume. > > > > > > This checks the UBI volume for which we are trying to skip the CRC check > > > is static. > > > > > > Suggested-by: Boris Brezillon > > > Signed-off-by: Quentin Schulz > > > Reviewed-by: Boris Brezillon > > > --- > > > drivers/mtd/ubi/cdev.c | 4 ++++ > > > drivers/mtd/ubi/vmt.c | 3 +++ > > > include/uapi/mtd/ubi-user.h | 16 ++++++++++++++-- > > > 3 files changed, 21 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c > > > index 45c3296..3eea1df 100644 > > > --- a/drivers/mtd/ubi/cdev.c > > > +++ b/drivers/mtd/ubi/cdev.c > > > @@ -622,6 +622,10 @@ static int verify_mkvol_req(const struct ubi_device *ubi, > > > req->vol_type != UBI_STATIC_VOLUME) > > > goto bad; > > > > > > + if (req->flags & UBI_VOL_SKIP_CRC_CHECK_FLG && > > Oops, missed that req->flags & UBI_VOL_SKIP_CRC_CHECK_FLG check was > missing parens (checkpatch --strict should complain about that). Latest when building my local branch or in linux-next we had noticed. No need to worry. > > > + req->vol_type != UBI_STATIC_VOLUME) > > > + goto bad; > > > > We should also reject unknown flags here. > > I agree. Talking about missing checks, it seems that none of the > padding sections are checked (I hope all mkvol users are zero-ing the > struct as requested in ubi-user.h). And we should probably also > check that vtbl->flags does not contain unknown flags. At least mtd-utils does zeros the request struct before using it. So it does the right thing. Adding checks for non-zero padding and more checking for vtbl->flags is a good idea. Thanks, //richard