Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3526224pxf; Mon, 15 Mar 2021 11:31:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhjTj2hmavgRIQjTY/308OuaximiIlcLp911hg7dHr3l0ZxjOFKnfIs97Dlpl0qds294eA X-Received: by 2002:a17:907:2112:: with SMTP id qn18mr24739600ejb.220.1615833062134; Mon, 15 Mar 2021 11:31:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833062; cv=none; d=google.com; s=arc-20160816; b=JC1QT1+lmwbuWiKDsmu/m6vdTOXkpUuXBPK6SlbmDJ8Ca353Lq+NRTFx+h1n0zH0CY gXPVFCKxv7zUkX8qfX7jj6QkHDBCrYxhq4lgx0y6gU9ojOhHHq9iNdoViwRQLAyXFYDb UVJOdYUXHvwv1TOxgpcEyRH3XC9hXlHWDx863CNlsQHN08FCqu/7RpahS9CtpSa7hrXx kI3W0A1SwvL8dvMvwESrGMDRubUD0oc/g2ygoR1cpgjyg0KMwtd558zCiXGY172Zymvn lFqXUAXPyZjVPGDW27yhzAqxm4tBRkhA2shhYy+Rqzor4fs4mwb7YfmW0laD0tRF/3az mdpQ== 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=zzPG1W1I4X5Da1cskiWrlI7Kis1YeRbD7yyD8k83282eExiV2oUR1SBA4EvoULDVcP X8cpthQhcJa4KrIR2VqA6hQ7tmiNEAmoSb3QH45/SccXDKTsz7kHPKkbx6KjqklneZaX uZd3d/+tLE08CaztTCjLMZBaivZt3STpakCc1L4y1w/+01OwactVsgkpWdzTnb+RWMkr Xpz0CNrEl9R6jaB+0cK0fL0I8Lgvs6bgiuPnPxaiYGL6BKaYSs1KSrWSRSClgx4lz0nT 4ht0HvF3RKT1jzIwf+8xbU/Kxq3kQoX0JznEhOhLaU9cSRZ92RIoS5tU/3YWWUFohXG7 caSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rC7qsszv; 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 24si12148927edv.533.2021.03.15.11.30.38; Mon, 15 Mar 2021 11:31:02 -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=rC7qsszv; 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 S240442AbhCOOh4 (ORCPT + 99 others); Mon, 15 Mar 2021 10:37:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:47922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233191AbhCOOBt (ORCPT ); Mon, 15 Mar 2021 10:01:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 13B9E64EF8; Mon, 15 Mar 2021 14:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816909; bh=FTAwELuj2EcQRMLn9mlwt2MunR7r3AyeDut4nIGaRjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rC7qsszv565+rLEVBc1n2GeCQ18P+X852i5FA3EmbNTO7CqP5a/wodkVl9rVVGx40 7G1X9EUsyfxSSfULBUH0XRNg6BQIU1j+aDEJCOYGEymdllHGJdqDIqIFqlh/V+3NEM QTwQEGESqB2uQE+QCs0A8ylT8SclImH3aPo6GE60= 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.11 195/306] USB: gadget: u_ether: Fix a configfs return code Date: Mon, 15 Mar 2021 14:54:18 +0100 Message-Id: <20210315135514.221199882@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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; \ } \