Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3258242rwb; Mon, 15 Aug 2022 22:31:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR7pfGSYtz92g9TwvGY3VspiVmzRx6pciL66X1Nx2a4mwtm3fRbOR6mQ+zaKtPSGiqS2MvX6 X-Received: by 2002:a17:90b:1a8f:b0:1f4:fb36:a9b3 with SMTP id ng15-20020a17090b1a8f00b001f4fb36a9b3mr22067426pjb.186.1660627888795; Mon, 15 Aug 2022 22:31:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660627888; cv=none; d=google.com; s=arc-20160816; b=U1U4zgEFt+erGO8drL+5dnZWpnP0LcWf9XXlXik08FBwLemCTbcOl7bUFIdbz4FP6G Ni/bCCpeRISv+1Uxam0f5PULPEFTKuJ1oS04mPxwmFhC8dQdfkMnWC3ynuLHac8IgtLx HTxEgNhnZboE+5ymbzMCPKKIwF2kI+/v+6MbARasMFp9XDjmpl1w3E5pabzI/I1l1HLk ve4GbYPrSIc22t605Dsrr94OdQYNDAbxx5MdvONoL7njES46msSDs06iU0rZJPSG8VA8 i8XOcIyqxbhE/sxY2G5qcrTzHfI5vfCUQsOw87YYsx7yx6tHAfiDuncB4HS2U7eG71ot 7lLQ== 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=SZ5JH7UW757jq0ozskFCSx+FGFRh+Ny0zNrN0N8p1+E=; b=hLbI/LGL96KdIHLuANEESaJ+Ejq5YlrOOgSlMOiFqlD1OE0sl51HuuKjm0Jae9v2wb cH9/FGkG/td8RhcLJpbUBEMcf8+WMgrNMFj61RRsjaGFZ+RwtMPbKNO7vhdKOOJO5BB4 WXCHnZAJZKGpPvdd8iuQ11YNyGl6qotjb42RMYeH+9+kKnevpAmgJoZzuzVvrChe7KyT Q2a6Dcu7m75TYT84Ur9B0+NAuPhwSwr3o8VTLKUopAsgK6LeL3bWWBHVUfMfgwilkVca H27m8vlIdOxn/FHxwl7ntOEj9TL109N7vxwrduLFruOZDi1umHgyLN0ixS95zTJIoFTb lzOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rWAZnmrK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a17090a461800b001f27babb6fbsi10931550pjg.56.2022.08.15.22.31.15; Mon, 15 Aug 2022 22:31:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rWAZnmrK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231405AbiHPEju (ORCPT + 99 others); Tue, 16 Aug 2022 00:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231401AbiHPEjZ (ORCPT ); Tue, 16 Aug 2022 00:39:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A673A176DFE; Mon, 15 Aug 2022 13:30:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1024B81197; Mon, 15 Aug 2022 20:30:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A8CBC433D7; Mon, 15 Aug 2022 20:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595403; bh=4i7vltTZ6/Ns+06g/Mgj3J86ow/1JZl4M2VlJk+Knfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rWAZnmrKD6KfPoZR6iG70hAhHMDzCr33U7AqaiSbKM3fTkqyx/+pfOru/pmfqSOTg 9fSoMWi01L9cTii9gRH1oMSIW08Bf2Pc+kzk2cYUKiFAQekmMptXBSHNAwg5LQseB3 zLhPKeOqL6KpbfrDpEJNO22IGHmL2Uise+ck+Z6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Mathias Nyman , Sasha Levin Subject: [PATCH 5.19 0752/1157] usb: host: xhci: use snprintf() in xhci_decode_trb() Date: Mon, 15 Aug 2022 20:01:48 +0200 Message-Id: <20220815180509.582738171@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov [ Upstream commit 1ce69c35b86038dd11d3a6115a04501c5b89a940 ] Commit cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing") apparently missed one sprintf() call in xhci_decode_trb() -- replace it with the snprintf() call as well... Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Fixes: cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing") Signed-off-by: Sergey Shtylyov Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220630124645.1805902-2-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 28aaf031f9a8..1960b47acfb2 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -2417,7 +2417,7 @@ static inline const char *xhci_decode_trb(char *str, size_t size, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_STOP_RING: - sprintf(str, + snprintf(str, size, "%s: slot %d sp %d ep %d flags %c", xhci_trb_type_string(type), TRB_TO_SLOT_ID(field3), -- 2.35.1