Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp608436ybz; Wed, 15 Apr 2020 15:04:12 -0700 (PDT) X-Google-Smtp-Source: APiQypJAV3d0LcYqkfAIeEI0mgidXYs+Tbb+1T11t4mcHqEebMT4S7mnXPgUgDbgAT/LmLx7WJ8s X-Received: by 2002:aa7:ca53:: with SMTP id j19mr27422647edt.229.1586988252477; Wed, 15 Apr 2020 15:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586988252; cv=none; d=google.com; s=arc-20160816; b=dFIgIV6Uv2wTFNV6WFJSJWzdnOFs3XgSrylkox60Y/Qo2KVyeVqyup3jG34VEioqke dBOZ613NuwOEmJjN35Soz7p6+fl+3rnwHegZmpyqaDlPhNMie+xu1rxns99SIoxt1hLv wjDZcgqmruiuczj313lLxjpvjoSQ0+jUzMkbKUNbHxXT3140hbwWSUY26eQWnBSwuzWs 2FlnmAdDKIKAEKWFElvUmCbww3Ar2V61G7It1nN7L4X3wuECYaZu4/TwX29hJARQNvoG 3QuV0oXFcnVO/KfCe9N0zTgCC5EtsvpK7O/32M2QG8S08ef5+8Du+IyxQmGZ0cumZrlD uDYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=rl9PWj3uTfyqXygouG7eBzkOuRR3ht3SlSVZEdS5vi4=; b=JNU8QEksL2JNyKr3fYvq8n27BM4k+YAh9eJ3Q9Zas4pxzXn75o7BsDb7n5vQ+DQKzw apYWaXlNgwRZT5Y9bxker2EDdIvXwrS6+LmiaI008jgIRuE4+AU2/rSldW90uq4yvvpn HS2+CkcYeY+/XVsWtOJ236kK2wOIAl9CN0kDB/3fjHDLjFm5nxDXgIgkPSW3vLTjCz6m tslGh+c7Nm14uU7aVJbh7qaQQUKAu0iAJmYsOSh/LWMGEhiS5JzggomCUx5IkRlf7mXF 1A9RUpaXbaEfu01hA/KcSkdgz4iU1MTtSxSLuDQWqXP9gcMf/4U9H+0adKIZmkrDEOIm Q4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WReb3Foo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si11479611edf.135.2020.04.15.15.03.48; Wed, 15 Apr 2020 15:04:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WReb3Foo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731026AbgDODKz (ORCPT + 99 others); Tue, 14 Apr 2020 23:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731048AbgDODKp (ORCPT ); Tue, 14 Apr 2020 23:10:45 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87A97C061A10 for ; Tue, 14 Apr 2020 20:10:45 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id r4so868373pgg.4 for ; Tue, 14 Apr 2020 20:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rl9PWj3uTfyqXygouG7eBzkOuRR3ht3SlSVZEdS5vi4=; b=WReb3FooecG/mGVKk7KoTDNmzBB8JA07kS8Wlt7cGOj1b+24cYEuDDpfQIYT19Pgq3 D6Lmumf0FVKLo2Mq50BPVQcRiaZfDl6vC92/MGZX/r0LfWfPWUejG4s92xqamybetQPm UmeEt0q1UUwCZuMGpM5Q2JjGxrKiO51WcBNsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=rl9PWj3uTfyqXygouG7eBzkOuRR3ht3SlSVZEdS5vi4=; b=dPzPzwiH38nALXYY/YuLTGbGmAc7UnyLFpWFHl0KdudEu7YQWYcM3rBLIxIaxwuikj 1a/UeeVHFsESttMJqpUQvzvSXW71LiP35c5bRcKCmVkrGNk9Ul3cAp69NM+cRyZ2Adbj yrmhtgHwtItuzbuB7MSvcKCOXzMO7hpa2ICRCkRJ3KkNhW8zmE2Rflv+fy9vtODCSmak 35/3kODlwvxon+K+4ZWmwCNYyCS/zzzXdH+13wC/v0ooMJjRgUyiemlwEkawpaq9J2o1 raLlJqDH3E1W41JOShsMclRz6v2OyKe7KD4GQSNeM9L+ZTxB+tfBk0r4e2mLg21kO0Dy Fymw== X-Gm-Message-State: AGi0PuYU4DV6hsrjYwgRZHK5yzpiJd/RWopTLMfRvueGzfRR9vFxBcZk mHpwe6xxEHv1FwGml5PD7wLgUQ== X-Received: by 2002:a62:e213:: with SMTP id a19mr11074202pfi.180.1586920245009; Tue, 14 Apr 2020 20:10:45 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 189sm12161684pfg.170.2020.04.14.20.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 20:10:44 -0700 (PDT) Date: Tue, 14 Apr 2020 20:10:43 -0700 From: Kees Cook To: Scott Branden Cc: Luis Chamberlain , Greg Kroah-Hartman , David Brown , Alexander Viro , Shuah Khan , bjorn.andersson@linaro.org, Shuah Khan , Arnd Bergmann , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-fsdevel@vger.kernel.org, BCM Kernel Feedback , Olof Johansson , Andrew Morton , Dan Carpenter , Colin Ian King , Takashi Iwai , linux-kselftest@vger.kernel.org, Andy Gross Subject: Re: [PATCH] test_firmware: remove unnecessary test_fw_mutex in test_dev_config_show_xxx Message-ID: <202004142010.C0847F5@keescook> References: <20200415002517.4328-1-scott.branden@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200415002517.4328-1-scott.branden@broadcom.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 14, 2020 at 05:25:17PM -0700, Scott Branden wrote: > Remove unnecessary use of test_fw_mutex in test_dev_config_show_xxx > functions that show simple bool, int, and u8. I would expect at least a READ_ONCE(), yes? > > Signed-off-by: Scott Branden > --- > lib/test_firmware.c | 26 +++----------------------- > 1 file changed, 3 insertions(+), 23 deletions(-) > > diff --git a/lib/test_firmware.c b/lib/test_firmware.c > index 0c7fbcf07ac5..9fee2b93a8d1 100644 > --- a/lib/test_firmware.c > +++ b/lib/test_firmware.c > @@ -310,27 +310,13 @@ static int test_dev_config_update_bool(const char *buf, size_t size, > return ret; > } > > -static ssize_t > -test_dev_config_show_bool(char *buf, > - bool config) > +static ssize_t test_dev_config_show_bool(char *buf, bool val) > { > - bool val; > - > - mutex_lock(&test_fw_mutex); > - val = config; > - mutex_unlock(&test_fw_mutex); > - > return snprintf(buf, PAGE_SIZE, "%d\n", val); > } > > -static ssize_t test_dev_config_show_int(char *buf, int cfg) > +static ssize_t test_dev_config_show_int(char *buf, int val) > { > - int val; > - > - mutex_lock(&test_fw_mutex); > - val = cfg; > - mutex_unlock(&test_fw_mutex); > - > return snprintf(buf, PAGE_SIZE, "%d\n", val); > } > > @@ -354,14 +340,8 @@ static int test_dev_config_update_u8(const char *buf, size_t size, u8 *cfg) > return size; > } > > -static ssize_t test_dev_config_show_u8(char *buf, u8 cfg) > +static ssize_t test_dev_config_show_u8(char *buf, u8 val) > { > - u8 val; > - > - mutex_lock(&test_fw_mutex); > - val = cfg; > - mutex_unlock(&test_fw_mutex); > - > return snprintf(buf, PAGE_SIZE, "%u\n", val); > } > > -- > 2.17.1 > -- Kees Cook