Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754774AbeAHRnq (ORCPT + 1 other); Mon, 8 Jan 2018 12:43:46 -0500 Received: from mail-wr0-f177.google.com ([209.85.128.177]:37958 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753793AbeAHRno (ORCPT ); Mon, 8 Jan 2018 12:43:44 -0500 X-Google-Smtp-Source: ACJfBotDoaBVFP3kBGA9Lvj2Lo0YGRbCUSVgpnTKzLhgHuKUDzOCkGUwjAkCOo6JgmYMYrDIN/XTww== Date: Mon, 8 Jan 2018 20:43:40 +0300 From: Alexey Dobriyan To: tim.c.chen@linux.intel.com, aarcange@redhat.com Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/8] x86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature Message-ID: <20180108174340.GA7310@avx2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: > + len = sprintf(buf, "%d\n", READ_ONCE(*field)); READ_ONCE isn't necessary as there is only one read being made. > + len = min(count, sizeof(buf) - 1); > + if (copy_from_user(buf, user_buf, len)) > + return -EFAULT; > + > + buf[len] = '\0'; > + if (kstrtouint(buf, 0, &enable)) > + return -EINVAL; There is kstrto*_from_user().