Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3527300pxf; Mon, 15 Mar 2021 11:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0NdNVzVsbWflRMJfb5J5Wj+rGf+qZ5odTlkiylZPnL/nmIRPolFpDB+S9wEix/+uQz0S4 X-Received: by 2002:aa7:c386:: with SMTP id k6mr31155251edq.224.1615833149941; Mon, 15 Mar 2021 11:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833149; cv=none; d=google.com; s=arc-20160816; b=Qwq8S9AvWhxBiZ8o/n2MrnvYGd38kl0SnP0KGxb0van+Ha25Vzdrc0eUabtgjWhcUf ecXTGWYp4kSte6PlUCAmR0azyC+OCmT0hZf5bsdIdasY7udKgGsQ8rk1AErvyy76Nj6W jLi3JwOb2V+kieEJIdeYyoLj2cOWOrOF2rfKWCzN0CBOie5d08tIdg0AEGuhaaegByYV lGIKZuTw6OpEosYayN/FpLHiXmd4ZVEktoYFE6YJK4R+Yzzp+5extrCTxupHYeBLNOY0 Vu62dOiCLWRXDnDNhGZSs6BArrQpQgR4BoR3J01Chygx8/SKwU77FahEK9coOBjGKD/7 4c3g== 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=bkWqLFMDKd8Zx+kd9goCno4g7i9VdJz+s2mf3dpjttRR3DQclTmwnBbWumAUteY/8n 9R9HzFTNVQNTko2hMD3hsGL2gSIxPBxnl0ZhDcLN+h5KqLyJ+ohcE1Q1HnsmSiIiaFru 2zwOd2FZCBphylVlsRY239gaNdrBb7NOsh+42x/aBldpQGFuHkNm10uWj2schTdk5Mr5 6Zs+ZOeDNkFoZEJBWRVjR4nCbm7pV/AupjiysNXSj020MPKKz+/lGwGaeo4+SzdIIv2M jeAUHMjJaug/7PB+tPutbTM4oKy/fm0jVNz7qL0JFCWQ50Tn7+ghsLQZytNNqRSkFnvQ jetg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wY3N3c1I; 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 gs18si12388891ejb.648.2021.03.15.11.32.07; Mon, 15 Mar 2021 11:32:29 -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=wY3N3c1I; 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 S236960AbhCOOjX (ORCPT + 99 others); Mon, 15 Mar 2021 10:39:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:48980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233700AbhCOOCT (ORCPT ); Mon, 15 Mar 2021 10:02:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06DB664E89; Mon, 15 Mar 2021 14:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816939; bh=FTAwELuj2EcQRMLn9mlwt2MunR7r3AyeDut4nIGaRjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wY3N3c1I8T7xQj8ck3R4/5L5Z/TtIKg+2Q4GqBdJGjdF0lUJjpK6jiDifc3k3nzRj Oixtb05FWDr2RrhjMyFwCtYjyOX2nQblSAo3+PI0qlRYmGYV6U80xfyp+uUiO+8+j6 2AG+jUBsgNjRZtV7AbykgQ5HtpTMrGM8s0MHPozE= 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.10 199/290] USB: gadget: u_ether: Fix a configfs return code Date: Mon, 15 Mar 2021 14:54:52 +0100 Message-Id: <20210315135548.640338185@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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; \ } \