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=-11.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 A3F13C388F7 for ; Fri, 13 Nov 2020 00:21:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34B3821D79 for ; Fri, 13 Nov 2020 00:21:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="T1Fms8N1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726260AbgKMAVH (ORCPT ); Thu, 12 Nov 2020 19:21:07 -0500 Received: from linux.microsoft.com ([13.77.154.182]:44610 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbgKMAVH (ORCPT ); Thu, 12 Nov 2020 19:21:07 -0500 Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by linux.microsoft.com (Postfix) with ESMTPSA id BD3BB20C2884 for ; Thu, 12 Nov 2020 16:21:06 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BD3BB20C2884 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1605226866; bh=nz9yqF8USSSrlPERDOTsESfQ4zYSnGbwhAj5bwSzo9k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=T1Fms8N18/7ISgemHDkQgygUCnbnsqXUBf3qWVP47J+In0cNJn3kxTxT2g4LiSVSs d7emHREfG0rs7vdYNNhDXz17eFXC/83F1MvACQiKAZtKqmXnd+3gYREXE6OY6QnEFK QFA8FNnYkZeimRDKPoT8p/MnSC0LzqM4AGCbNCCc= Received: by mail-qv1-f48.google.com with SMTP id r12so3787258qvq.13 for ; Thu, 12 Nov 2020 16:21:06 -0800 (PST) X-Gm-Message-State: AOAM533nYmZW59xwUqZ2zxCQBqz72TW5IqL90opbpDyMgISBlV/QhYHr knv00vcpGTs3iOwpRfWLCN1Bkj3DNmZQF0vt760= X-Google-Smtp-Source: ABdhPJzxtgNKZgLQd0qw/4EC1rbVIj3JHrc1hhlJSvSl8FJuKTgHK/MuRAFV/iEsmRA5CJSg+QR6fh9bSEmRjnuSX1M= X-Received: by 2002:ad4:490d:: with SMTP id bh13mr2423164qvb.14.1605226865807; Thu, 12 Nov 2020 16:21:05 -0800 (PST) MIME-Version: 1.0 References: <20201110202746.9690-1-mcroce@linux.microsoft.com> <20201112035023.974748-1-natechancellor@gmail.com> <20201112151320.e0153ace2f2eb5b59eabbdcb@linux-foundation.org> In-Reply-To: <20201112151320.e0153ace2f2eb5b59eabbdcb@linux-foundation.org> From: Matteo Croce Date: Fri, 13 Nov 2020 01:20:29 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] reboot: Fix variable assignments in type_store To: Andrew Morton Cc: Nathan Chancellor , Arnd Bergmann , Kees Cook , linux-kernel@vger.kernel.org, Guenter Roeck , Pavel Tatashin , Petr Mladek , Mike Rapoport , Tyler Hicks , Nick Desaulniers , clang-built-linux@googlegroups.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 13, 2020 at 12:13 AM Andrew Morton wrote: > > On Wed, 11 Nov 2020 20:50:23 -0700 Nathan Chancellor wrote: > > > Clang warns: > > > > kernel/reboot.c:707:17: warning: implicit conversion from enumeration > > type 'enum reboot_type' to different enumeration type 'enum reboot_mode' > > [-Wenum-conversion] > > reboot_mode = BOOT_TRIPLE; > > ~ ^~~~~~~~~~~ > > > > ... > > > > --- a/kernel/reboot.c > > +++ b/kernel/reboot.c > > @@ -704,19 +704,19 @@ static ssize_t type_store(struct kobject *kobj, struct kobj_attribute *attr, > > return -EPERM; > > > > if (!strncmp(buf, BOOT_TRIPLE_STR, strlen(BOOT_TRIPLE_STR))) > > - reboot_mode = BOOT_TRIPLE; > > + reboot_type = BOOT_TRIPLE; > > else if (!strncmp(buf, BOOT_KBD_STR, strlen(BOOT_KBD_STR))) > > - reboot_mode = BOOT_KBD; > > + reboot_type = BOOT_KBD; > > else if (!strncmp(buf, BOOT_BIOS_STR, strlen(BOOT_BIOS_STR))) > > - reboot_mode = BOOT_BIOS; > > + reboot_type = BOOT_BIOS; > > else if (!strncmp(buf, BOOT_ACPI_STR, strlen(BOOT_ACPI_STR))) > > - reboot_mode = BOOT_ACPI; > > + reboot_type = BOOT_ACPI; > > else if (!strncmp(buf, BOOT_EFI_STR, strlen(BOOT_EFI_STR))) > > - reboot_mode = BOOT_EFI; > > + reboot_type = BOOT_EFI; > > else if (!strncmp(buf, BOOT_CF9_FORCE_STR, strlen(BOOT_CF9_FORCE_STR))) > > - reboot_mode = BOOT_CF9_FORCE; > > + reboot_type = BOOT_CF9_FORCE; > > else if (!strncmp(buf, BOOT_CF9_SAFE_STR, strlen(BOOT_CF9_SAFE_STR))) > > - reboot_mode = BOOT_CF9_SAFE; > > + reboot_type = BOOT_CF9_SAFE; > > else > > return -EINVAL; > > This is a fairly dramatic change to the original patch, but it eyeballs > OK. > > Matteo, could you please comment? And preferably retest? > Hi, I reviewed the patch and it looks good to me. I tested it with this script which passes now with Nathan's fix: for i in cold warm hard soft gpio; do echo $i > mode read j type read j cpu read j force read j