Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3521960pxf; Mon, 15 Mar 2021 11:25:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMhEQYWvTQY8cPuNwRkDZjEpPhbYi3npvDQKpRKkMTVyy/gfAWkOMQpw8B7SSAbYdwN7TO X-Received: by 2002:a17:906:ad96:: with SMTP id la22mr26118387ejb.237.1615832719184; Mon, 15 Mar 2021 11:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832719; cv=none; d=google.com; s=arc-20160816; b=bcImINRUmdsgFqeLxZo5mdPMNbQM3toHVqrRYPILIOf0KBwz+6EOVwlmTGdelsZZC8 Jh8Bv8o3lzpJfHvR9MbVXWz91FBojoOruRd1UlHyOl5ayScStzq63xlnWzDCHSna3myF 6FxSRc84HrDaekNu5n0HYKgf73JMhETkmfuihYJCaAeJTOl/uBcU69bgx61yT8Ei+4W/ WoGWJPdStBo2r3cvruha7HeGK5zjF80KERVDSaGfRwPiSJWj+FLSOAkVVQR0Tyv3xFSk NcQympLzE8Ln2J2kX0ixKeSv5bX+tno9g0MA3N2Sinzc1e8Er4QwdVDLm5zGT+oILSTZ YdhQ== 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=Za+0idBlPaTnjqlkOKkEXZljFJ48oP1DW7Qu64rFlnCtRoFE5TKEE33+wDVN9fHtVa ieCfTet7/mmHlS1LqEOw0Ux1RFTdVBNy3E1y+eExBenMOXP2GKEwRc54pAh4cnO1c+Sj YcjH06bJn7Z12rFK5i0mInpLfvAjl5NTayUIW1XgXLEwKVvpMteyoJCv8mJPNtS4broO Zo8nNcW3nR7OlfOjmJLYVCCdejgwVT/CC1Y1Luc1ZXaQes1+z20Nnr9tGZPhmQ6/YHir Tw7CSHtz/O6aWNstHWq1r23PnIoKSX799doaHr48X0H7ZUPVFBrPbI/hnRhWD6tB0X41 dbOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x9A6+sqp; 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 z18si11459531ejx.409.2021.03.15.11.24.57; Mon, 15 Mar 2021 11:25:19 -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=x9A6+sqp; 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 S233946AbhCOOZO (ORCPT + 99 others); Mon, 15 Mar 2021 10:25:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:35446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232805AbhCOOAT (ORCPT ); Mon, 15 Mar 2021 10:00:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E68C264F2F; Mon, 15 Mar 2021 13:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816793; bh=FTAwELuj2EcQRMLn9mlwt2MunR7r3AyeDut4nIGaRjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x9A6+sqpr7C2CBDUYpENgWh9CJdFqEGQk8npWJtLTIImK6xtjvPJR96x7s8ZLjKXz mfOdPC0ovvcFRrswvC1ZPAmSxAaVKSyUpWdl4eFSReuYy40fUHzYgbGPO5k0AqBhia GTczQcWMy1HfktBJ6gpDtgnxFIYiF8Yq9AThOzeM= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Colitti , Dan Carpenter Subject: [PATCH 4.19 071/120] USB: gadget: u_ether: Fix a configfs return code Date: Mon, 15 Mar 2021 14:57:02 +0100 Message-Id: <20210315135722.306884259@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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; \ } \