From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E16E2C2D0C1 for ; Thu, 19 Dec 2019 19:02:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AD0DE2465E for ; Thu, 19 Dec 2019 19:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576782128; bh=7PEIWwLDWxkjIs0y/4eDDC+vqmuU+o1OG8Hke4RCuLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=B2WBlBWL2ewYGcOHUKkqwzkMaA+QEHpZFUwyHlbRNiz4aeQyJEEPecRDTQTvOimEb yu6fFDznM1D8rVIHXzTnU4otfFdgdfIhQG5TS3T4IL+BrCbIxNLEsPD/HEbozitCRB RR3TiQ/pUl93iKlgPZ1wgXpDZ8SCVNJA9dqxmLd0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729894AbfLSSt4 (ORCPT ); Thu, 19 Dec 2019 13:49:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:43522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729876AbfLSStx (ORCPT ); Thu, 19 Dec 2019 13:49:53 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6E1B2465E; Thu, 19 Dec 2019 18:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781393; bh=7PEIWwLDWxkjIs0y/4eDDC+vqmuU+o1OG8Hke4RCuLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wkh3407j19aOzSh8Yd2CsLuQZUPmUWigczE0Ck57zeQS7/+MTwZNUH44YgOesG8c3 oyCsmb89PlzEyqd8hPe0Eqxt1KQOhoTkvB27SDugelRxaextJmBMi+wHM6OxDd906h PKekalv/Vy1/qgKSs8Cl3sVGaqm8hJ+oH0FlOTo0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Lei , Jens Axboe , Nobuhiro Iwamatsu Subject: [PATCH 4.9 170/199] blk-mq: make sure that line break can be printed Date: Thu, 19 Dec 2019 19:34:12 +0100 Message-Id: <20191219183224.907012895@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183214.629503389@linuxfoundation.org> References: <20191219183214.629503389@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ming Lei commit d2c9be89f8ebe7ebcc97676ac40f8dec1cf9b43a upstream. 8962842ca5ab ("blk-mq: avoid sysfs buffer overflow with too many CPU cores") avoids sysfs buffer overflow, and reserves one character for line break. However, the last snprintf() doesn't get correct 'size' parameter passed in, so fixed it. Fixes: 8962842ca5ab ("blk-mq: avoid sysfs buffer overflow with too many CPU cores") Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Cc: Nobuhiro Iwamatsu Signed-off-by: Greg Kroah-Hartman --- block/blk-mq-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/blk-mq-sysfs.c +++ b/block/blk-mq-sysfs.c @@ -260,7 +260,7 @@ static ssize_t blk_mq_hw_sysfs_cpus_show pos += ret; } - ret = snprintf(pos + page, size - pos, "\n"); + ret = snprintf(pos + page, size + 1 - pos, "\n"); return pos + ret; }