Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2187333rdb; Sun, 24 Dec 2023 23:13:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmIBvZMBuaEQaPQYur+F/MTlFZT7IDlVJXrQTCCLcgK+BvWAhIwfc/q8MabaWUeFInFC24 X-Received: by 2002:a05:6e02:1ca6:b0:35f:f13d:5c37 with SMTP id x6-20020a056e021ca600b0035ff13d5c37mr1904654ill.102.1703488439612; Sun, 24 Dec 2023 23:13:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703488439; cv=none; d=google.com; s=arc-20160816; b=smh7T1P5VvxWLgegKMirNGPDtMWCchHFvoN6Fi3dqrUfLX3WcR/6Mudvdce1TM+bCB sJ77ODNSOhQdHZPW7ur4usiqI+TNq8nnFVHVkpxVX2VlK7eHWNLGDdbCXFcfMN2mIdP1 xS8N0L7qzWVVxapiWv3vXB3RFnft/icnwNjYiFkNapwZ7Uk811VDCTU0mtTnASmVGoi6 WsFHMw8M/O58svw1viTo/QS5VZ7hqz0OwtnOVWxihWxd8m2d2p+52X0g+01k03JGlBEF 96YPZRh6ovQZhxla2t8/e1sPVznjh8b0RDvzfcB8gHATaf+wkXj1vh83R+Gsatnymg6M 4x3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=i/K7AfwRJpvrh6PQ59MmRsc8Ks3yg+sbCHVd26zGRwQ=; fh=XjbPFQV1q33pSyHU0DJViPof6LxQPkAWDXnCrlkcrhg=; b=bR6OzXRKEpfxHZW8e2d5o7B2tb2Ag0c6WTz5FBKY02baKQ/xhmOQ/xGarhAhbip4YF 7mL0sS9AhE+t/Wdtko/WgzIpVW9r6qrOo+zE5rs8aXO5BF9YntmfZraXd86zQoHv0KQG 0bRNTuRphHvz+DUVWBxjJROiLxiZoaJugG5/6ePWswlsh7A3RP1OetIUvyNlIzpiR8k3 XYJ8+ZzQD/C5GtclhB9qtAxWBKyDj+I67+RbYhdQU94kw+M1L6Yw3Q94dZy/5rbkiZkl 9jK81gQbGMUiZg1K/facWZITpgUUxNf7aRC5mIXfVENrk36tGLp2g5SwqTA5ADW5pBP/ 7Vbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10923-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cb9-20020a056a02070900b005cd8fa82040si3772934pgb.614.2023.12.24.23.13.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 23:13:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10923-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10923-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A68FDB2105F for ; Mon, 25 Dec 2023 07:13:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FFF85C9A; Mon, 25 Dec 2023 07:13:22 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38B0F15AF for ; Mon, 25 Dec 2023 07:13:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Sz8H55DLPzvSZZ; Mon, 25 Dec 2023 15:12:17 +0800 (CST) Received: from dggpemd200001.china.huawei.com (unknown [7.185.36.224]) by mail.maildlp.com (Postfix) with ESMTPS id 6377218005E; Mon, 25 Dec 2023 15:13:17 +0800 (CST) Received: from huawei.com (10.175.104.67) by dggpemd200001.china.huawei.com (7.185.36.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.28; Mon, 25 Dec 2023 15:13:16 +0800 From: ZhaoLong Wang To: , , CC: , , , , , Subject: [PATCH v5 4/5] ubi: Reserve sufficient buffer length for the input mask Date: Mon, 25 Dec 2023 15:10:54 +0800 Message-ID: <20231225071055.1721000-5-wangzhaolong1@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231225071055.1721000-1-wangzhaolong1@huawei.com> References: <20231225071055.1721000-1-wangzhaolong1@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemd200001.china.huawei.com (7.185.36.224) Because the mask received by the emulate_failures interface is a 32-bit unsigned integer, ensure that there is sufficient buffer length to receive and display this value. Signed-off-by: ZhaoLong Wang Reviewed-by: Zhihao Cheng --- drivers/mtd/ubi/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index e8aa1827f23a..b4f40cd2bdaf 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c @@ -332,7 +332,7 @@ static ssize_t dfs_file_read(struct file *file, char __user *user_buf, struct dentry *dent = file->f_path.dentry; struct ubi_device *ubi; struct ubi_debug_info *d; - char buf[8]; + char buf[16]; int val; ubi = ubi_get_device(ubi_num); @@ -400,7 +400,7 @@ static ssize_t dfs_file_write(struct file *file, const char __user *user_buf, struct ubi_device *ubi; struct ubi_debug_info *d; size_t buf_size; - char buf[8] = {0}; + char buf[16] = {0}; int val; ubi = ubi_get_device(ubi_num); -- 2.39.2