From patchwork Fri Dec 4 17:03:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francis Laniel X-Patchwork-Id: 11951971 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=-12.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_ALL,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 839C1C4361A for ; Fri, 4 Dec 2020 17:05:38 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AFC422B3B for ; Fri, 4 Dec 2020 17:05:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AFC422B3B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=privacyrequired.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=M/Yk1bAewYzry+vl4NZALyUR2464Gxf/MrqlBzmI93E=; b=18g/didZi1vZXQ4SMGNvzXXUrZ xaqgUfav3cQYxiI9YwGQxJmpqtAnAb3uMM8XN2KkYJJ68fJ957pMhj4/lcxclke3ynqSruhVycSQp WfIBR2U5d8QfN8ADRJbcU42KRJ+XVaCFlpdKosPOQYiRiVZdtLYvh0306JPKyakcVcxOVycoTTGMN c0R/+BBHPrT/q0EWQcg37/l/peIp7tyN73t7GmH+ngkzUj+Hg/hgyDjMtyRSjPE3fAwaf4YzJASvW +R5mDBwZv6IFh3F4TEOwa8NJats8h0xvxP0rvcqoLuV8jefQm37e8IrxkgUaPctmODmgSDitQVWj4 6TuE/6Qg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1klEVM-000228-Qf; Fri, 04 Dec 2020 17:04:24 +0000 Received: from latitanza.investici.org ([82.94.249.234]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1klEVI-0001zF-AT for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2020 17:04:22 +0000 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4CnfF12X1nz8shk; Fri, 4 Dec 2020 17:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=privacyrequired.com; s=stigmate; t=1607101445; bh=CNSPo3rU73iLufUhzAAlkyJdrqDxV3HykhrbciRVVqg=; h=From:To:Cc:Subject:Date:From; b=CAj2903IlbaunC80bM+z7sehEdvvySRvMXF2B7QVSeGl9c1o2+R49o1Johhg6BSQ4 Q4EMyEP3bIuGgoqirMK1uT98XPrJ1OTptjksAJf1V5Duw6RhXyRn+MKAiMRbwunKkr vE228J0uaZtyVw5ECCzsQr3hgtGk8lvECyg5M/Pg= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: laniel_francis@privacyrequired.com) by localhost (Postfix) with ESMTPSA id 4CnfDy1SRgz8sfb; Fri, 4 Dec 2020 17:04:02 +0000 (UTC) From: laniel_francis@privacyrequired.com To: Russell King , Hauke Mehrtens , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Thomas Bogendoerfer , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Herbert Xu , "David S. Miller" , Ard Biesheuvel , Tomi Valkeinen , David Airlie , Daniel Vetter , Laurent Pinchart , Kieran Bingham , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Bin Liu , Greg Kroah-Hartman , Jessica Yu Subject: [RFC PATCH v1 00/12] Replace strstarts() by str_has_prefix() Date: Fri, 4 Dec 2020 18:03:06 +0100 Message-Id: <20201204170319.20383-1-laniel_francis@privacyrequired.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_120420_580265_741A59D7 X-CRM114-Status: GOOD ( 16.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-efi@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-ide@vger.kernel.org, linux-crypto@vger.kernel.org, Francis Laniel , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Francis Laniel Hi. First, I hope you are fine and the same for your relatives. In this patch set, I replaced all calls to strstarts() by calls to str_has_prefix(). Indeed, the kernel has two functions to test if a string begins with an other: 1. strstarts() which returns a bool, so 1 if the string begins with the prefix, 0 otherwise. 2. str_has_prefix() which returns the length of the prefix or 0. str_has_prefix() was introduced later than strstarts(), in commit 495d714ad140 which also stated that str_has_prefix() should replace strstarts(). This is what this patch set does. Concerning the patches, the modifications cover different areas of the kernel. I compiled all of them and they compile smoothly. Unfortunately, I did not test all of them, so here are the status of the patches regarding test: 1. Tested with qemu-system-arm using insmod. 2. I do not have access to a bcm47xx MIPS CPU an qemu-system-mips does not emulate this board. 3. Tested with qemu-system-x86_64 calling crypto_alloc_skcipher("essiv(authenc(hmac(sha256),cbc(aes)),sha256)", 0, 0) through LKDTM. 4. Tested with qemu-system-x86_64 using crypsetup. 5. I do not have access to a renesas board and I lack some context to test it with qemu-system-arm. 6. I do not have access to an OMAP board and I lack some context to test it with qemu-system-arm. 7. I did not find how to boot from the EFI_STUB with qemu. If you know how to do, I would be happy to try running this code. 8. I ran qemu-system-x86_64 with a floppy disk attached but impossible to go through this module code... 9. I do not have access to a bcm63xx MIPS CPU an qemu-system-mips does not emulate this board. 10. Tested with qemu-system-x86_64 using insmod. 11. I do not have access to an AM335x or DA8xx platforms and I lack some context to test it with qemu-system-arm. If you see a way to improve the patches or if I did something wrong with the mail do not hesitate to ask. Best regards. Francis Laniel (12): arm: Replace strstarts() by str_has_prefix(). mips: Replace strstarts() by str_has_prefix(). crypto: Replace strstarts() by str_has_prefix(). device-mapper: Replace strstarts() by str_has_prefix(). renesas: Replace strstarts() by str_has_prefix(). omap: Replace strstarts() by str_has_prefix(). efi: Replace strstarts() by str_has_prefix(). ide: Replace strstarts() by str_has_prefix(). mips: Replace strstarts() by str_has_prefix(). module: Replace strstarts() by str_has_prefix(). musb: Replace strstarts() by str_has_prefix(). string.h: Remove strstarts(). arch/arm/kernel/module.c | 12 +++++------ arch/mips/bcm47xx/board.c | 4 ++-- arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- crypto/essiv.c | 2 +- .../firmware/efi/libstub/efi-stub-helper.c | 2 +- drivers/firmware/efi/libstub/gop.c | 10 +++++----- drivers/gpu/drm/omapdrm/dss/base.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 +- drivers/ide/ide-floppy.c | 4 ++-- drivers/md/dm-crypt.c | 4 ++-- drivers/usb/musb/musb_cppi41.c | 4 ++-- drivers/usb/musb/musb_debugfs.c | 20 +++++++++---------- include/linux/string.h | 10 ---------- kernel/module.c | 6 +++--- 14 files changed, 37 insertions(+), 47 deletions(-)