Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3084595rwb; Mon, 15 Aug 2022 17:45:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR7jmFs38W8fa7Olskky7AxMAMhK2+gJG1/ddnsCA3IT3nuZ7DIKIFpqMf0jjmCppUUC2/Pr X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr16497822edb.320.1660610706594; Mon, 15 Aug 2022 17:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610706; cv=none; d=google.com; s=arc-20160816; b=SwfyeK5kW+/km7Xci65Hq22Dh2R6/2OQrj5QT4pwhaL8c7z2g1/WQdDgtcy8/nf/sr MtnLg72eOoW00mMTNRp/6geDqGtDfqeeib1+TgeSbBpk/dNIKoDbFRQY8DS1UrZCG+qV 5RS2tGHbg34cw7XY8zyNanb5c7oi6JazYLstPiF7RdurNN3GfHiw2FcJfRlqBiDb0/Xx kNL2xlx8TI2MyCiHadOfTJIA3g5TCKsr7UH0WHCzDvrkJXvcK4A88QJr63btUH1BgJfM 9nhiC2DwCo4ij6U1Ae4a3ULgoiH0qk5vrda4JhY2QCLVUpinBHXDR9MzoLIEeYEiZJph RG4w== 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=WFsfjk8a+9cN7qNShl8cv4axNVfHv+QgTCsRqLbbyhg=; b=lA8IrCHAw4xlbz8H9OArdpD0OkBnCFbwWCJ4ooebkxmLh5DobO53pBF8ncDdCxEpl7 wGPneQweaZEe6K+R5QkJlZWhnzGMxADRFicthAaZ/lz9ttEPg4tHTEJiHAZXWO7p167N 73dNXumiZkBn3LR5ZmXfe8xc1GvyrfMgcjo4Dd8l/j68MlB5TJAngHA+1baRdS9pMqEW OBr5ry+FUx/xJqJPZYQtYHgjJ70v1GY9kfE6gyHeh4UkuA+4FMQchXyqrPCJqD5MPtbz e9Vz0vcjVc1KG1B3WEtpel/iZ0YfWiImf29vl90Hz+XGv6K0MakOVZ0TKBxLMhQO/PBY qz0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1wawT3C1; 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 w20-20020a056402269400b0043c23c5d892si10265523edd.444.2022.08.15.17.44.41; Mon, 15 Aug 2022 17:45:06 -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=1wawT3C1; 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 S1350399AbiHOVxD (ORCPT + 99 others); Mon, 15 Aug 2022 17:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349789AbiHOVsY (ORCPT ); Mon, 15 Aug 2022 17:48:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A452B2AE14; Mon, 15 Aug 2022 12:32:04 -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 sin.source.kernel.org (Postfix) with ESMTPS id E9735CE12C4; Mon, 15 Aug 2022 19:32:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2C2DC433C1; Mon, 15 Aug 2022 19:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591920; bh=rlc+TygH3/TDpI6G8/9xUMPvuJv/ForyaE2lXM7vA8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1wawT3C1aSwX6ayJs/hfOobHUdS6EMEUnRXd7ilLG8QzEwAuIWplEQrpuPNpQcXG9 G2se+gsKZ7xF7yXYauLKd6MZ6hMK8786a/8iDuPIQ89ReUOkdae9Ds4iBNsaxxXXWv fNRYFb7Lse+8SCgtLrIgW5aZVUULxfnk8AZDJOUg= 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.18 0704/1095] usb: host: xhci: use snprintf() in xhci_decode_trb() Date: Mon, 15 Aug 2022 20:01:43 +0200 Message-Id: <20220815180458.494210801@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 1f3f311d9951..1d60e62752f3 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -2393,7 +2393,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