From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2494FC4361B for ; Mon, 7 Dec 2020 15:11:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E13572370D for ; Mon, 7 Dec 2020 15:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbgLGPLJ (ORCPT ); Mon, 7 Dec 2020 10:11:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:57696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgLGPLI (ORCPT ); Mon, 7 Dec 2020 10:11:08 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 731A12370D; Mon, 7 Dec 2020 15:10:27 +0000 (UTC) Date: Mon, 7 Dec 2020 10:10:25 -0500 From: Steven Rostedt To: James Bottomley Cc: Ard Biesheuvel , laniel_francis@privacyrequired.com, linux-efi , Linux Kernel Mailing List Subject: Re: [RFC PATCH v1 07/12] efi: Replace strstarts() by str_has_prefix(). Message-ID: <20201207101025.1d133a5d@gandalf.local.home> In-Reply-To: <8a169362defed5af16be78c5a11f4ff9f58da2a8.camel@HansenPartnership.com> References: <20201204170319.20383-1-laniel_francis@privacyrequired.com> <20201204170319.20383-8-laniel_francis@privacyrequired.com> <3161fc13d69c388b1f51f59c6ecea48dcd0a7856.camel@HansenPartnership.com> <043040d9c092cedcab8bf88b0ec805616d3be44d.camel@HansenPartnership.com> <8a169362defed5af16be78c5a11f4ff9f58da2a8.camel@HansenPartnership.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 05 Dec 2020 15:04:31 -0800 James Bottomley wrote: > Well, I think the pattern > > if (strstarts(option, )) { > ... > option += strlen(); > > is a bad one because one day may get updated but not string>. And if is too far away in the code it might not > even show up in the diff, leading to reviewers not noticing either. So > I think eliminating the pattern is a definite improvement. And one of the reasons we created str_has_prefix() is because we fixed that exact bug, in a few places. It was caused by a typo, where we had something like: strstarts(option, "foo=") { option += strlen("foo"); and forgot the "=" part, and broke the rest of the logic. -- Steve