Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2546676rdb; Mon, 25 Dec 2023 17:05:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFT0VG9rMZ2K0TXy7ojpxYy9KOEeN3JJU+eJvH3TL8fH1Vb8/Q/xuh4bdxjwiY8isCfrDpY X-Received: by 2002:a05:600c:3208:b0:40c:29fb:2c4b with SMTP id r8-20020a05600c320800b0040c29fb2c4bmr3056330wmp.148.1703552705892; Mon, 25 Dec 2023 17:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703552705; cv=none; d=google.com; s=arc-20160816; b=UYhw5OJJ07Ie8sg/G0iCXTzRQqs+Nvh9l2Ko9eH6N2PG4MHuch1DTlGiW+1klVA0yt +LX1yc7Ldu40qdJg0dbkjamd12BuWEFXEvmEgLfdMmTw4qAMS87blputARyNoBlkTVjx OFGRDrci7cpaKBLDGBNyggFYTEVcHQEwhZcLSVed1A27zRpU5I8u765OrueiejxAf8eW bhUV5FT2Di0sshbHQ1nFjDdFhzn5HGzJWH2ofiMKUTvaWCK9N1ar4c8AVzpbSIZAVyjU RO6weqXUdarLvOqup0wfD9T8W/hDV6e9iLl4zy0twGlxsAJ/sjETT7zRDgDF+0txxp0b biug== 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=uMpo7+zTV4+PG7Ueo24GnbhG/vgH5gc3qaxgcVjBcz0=; fh=XjbPFQV1q33pSyHU0DJViPof6LxQPkAWDXnCrlkcrhg=; b=rAAKLbrUreV2o6/QEEy6eG3WCYPbh5icZdTRHDkC5T9Q7zF4WhEPtsNTTqg1tC9+X0 NOt8Ja7zu469ul0qrNm5arXvztt5zpgfgcml0KYA/d8aDK1uFvIWqiabQ8z5FMvG3Vdk EwoStRes6DMWeAE8Dvd8InzWx4z6n+NWhDmq918V+mKC+Ox122L1h3OUDtl0dST6dbS6 GkjwyIE7OFcXYesMidqB/vyDmhOghaxt7WKEyJoT1NewMVyc0Yg4Gf+bXicIdn87eRWS /Gj7pt/WFWtaASXDpcMROmlDectghoaUNiNsOmn0/orw3OAaoEYplUC70OhbjJQBxTFW rY7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11307-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gi9-20020a1709070c8900b00a1cfd94457esi4646920ejc.404.2023.12.25.17.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 17:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11307-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11307-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A05741F22519 for ; Tue, 26 Dec 2023 01:05:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 398FB5CB5; Tue, 26 Dec 2023 01:04:57 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (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 0BCBE5662 for ; Tue, 26 Dec 2023 01:04:54 +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.88.214]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Szc444CLlz1vpYB; Tue, 26 Dec 2023 09:04:20 +0800 (CST) Received: from dggpemd200001.china.huawei.com (unknown [7.185.36.224]) by mail.maildlp.com (Postfix) with ESMTPS id F38F41A019B; Tue, 26 Dec 2023 09:04:14 +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; Tue, 26 Dec 2023 09:03:30 +0800 From: ZhaoLong Wang To: , , CC: , , , , , Subject: [PATCH v6 4/5] ubi: Reserve sufficient buffer length for the input mask Date: Tue, 26 Dec 2023 09:01:12 +0800 Message-ID: <20231226010113.742079-5-wangzhaolong1@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231226010113.742079-1-wangzhaolong1@huawei.com> References: <20231226010113.742079-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 007f82d71020..d57f52bd2ff3 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