Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3519976pxf; Mon, 15 Mar 2021 11:22:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIjsPeebz/UerkXuCT339LmxG1QXDzKZNEuRmFHvtCfTxXDuO3AzmuSc6XwmUqxS4OpsUi X-Received: by 2002:a17:906:f88a:: with SMTP id lg10mr25692580ejb.39.1615832535653; Mon, 15 Mar 2021 11:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832535; cv=none; d=google.com; s=arc-20160816; b=qUJ+FDhi1Vy8enI1mY7xrWW9rCFwh/Vpo1Ng67iidmWkrUO3/HuIVnR/TB04bid+mu S7LiljUpz4TNzsxKqOnvCVucbfD/FPESWZQq+11lHzO6+E56oJDMqAHGoU8S/sambXZW PEx4lLDyORO2HqABxTmC98PMdo9/9I9bqHzasVM3ZcvIa8azcEodXssUCxAXbiuH4Be6 Wsy2rMe/HFABfNTX0m+BL/oWB4ZO0J8snrz0Z4yHjKONupq1uRgQsHa5xQvvsjQejPyN i0C6NTKVsXKNNDSkC8fp+Ok3XUj+VsZcBilbiUkivJdsDTj7YdVmYlh7KB2M8R5tuRoE 7h8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0HRb58Vao1YeNo8Gq7rhZuwMGcP2cGaxDeKUPBYEe7I=; b=aLNMxM8ecz/D7uExOQPs0pq9QkAzK8BbGMDX8USHMQvIYYPJe3UpyK38f1k0cPoVLY CoRNNQsNXz3M4l9EPOxnNVATFuVeGkkhgJn7bWeOvsLJpy9/W3K68zsJtCcrwcyi0kxY 3j4z1ZhYL/2Chm44ASu+tKOt/SeaKM8DhuCRcEperWL9Ddxr9V+5/ydinCdybWpkvgar Q1XufrMNxwm4MoiR8y10VEO7Fc7LuAeTvhWLDNksbB21K03AX66GWo7R+ROvmdaaX0SY qYeNA2nI3ZVLBa77Gta4/aviHFzkFa1XLjRw3OFuj424kKpAAkF/x+hAO595P9SYBelm FA0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mva0MIEc; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si12249239edc.76.2021.03.15.11.21.53; Mon, 15 Mar 2021 11:22:15 -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=@linuxfoundation.org header.s=korg header.b=Mva0MIEc; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233711AbhCOOV0 (ORCPT + 99 others); Mon, 15 Mar 2021 10:21:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232813AbhCON75 (ORCPT ); Mon, 15 Mar 2021 09:59:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 40AE564F0D; Mon, 15 Mar 2021 13:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816780; bh=FTAwELuj2EcQRMLn9mlwt2MunR7r3AyeDut4nIGaRjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mva0MIEcbqp38I9uWerltgKcgjc1JmuuFkI+XXb7M0f65UUgeLdAxZMnR5tmw/pjq jlazNSHHOj8tauZENBFL/flJQhrtCUSGXucRc4mZZeNnkNb4S2P8io6fDpZoMcejE8 QKbtioI3688UxulG2njkLbV6TfsNwW69KlKODr/U= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Colitti , Dan Carpenter Subject: [PATCH 5.4 104/168] USB: gadget: u_ether: Fix a configfs return code Date: Mon, 15 Mar 2021 14:55:36 +0100 Message-Id: <20210315135553.786047105@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Dan Carpenter commit 650bf52208d804ad5ee449c58102f8dc43175573 upstream. If the string is invalid, this should return -EINVAL instead of 0. Fixes: 73517cf49bd4 ("usb: gadget: add RNDIS configfs options for class/subclass/protocol") Cc: stable Acked-by: Lorenzo Colitti Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YCqZ3P53yyIg5cn7@mwanda Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/u_ether_configfs.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/usb/gadget/function/u_ether_configfs.h +++ b/drivers/usb/gadget/function/u_ether_configfs.h @@ -169,12 +169,11 @@ out: \ size_t len) \ { \ struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item); \ - int ret; \ + int ret = -EINVAL; \ u8 val; \ \ mutex_lock(&opts->lock); \ - ret = sscanf(page, "%02hhx", &val); \ - if (ret > 0) { \ + if (sscanf(page, "%02hhx", &val) > 0) { \ opts->_n_ = val; \ ret = len; \ } \