Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4351897rwb; Mon, 31 Jul 2023 05:48:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlE0XWCsplIH5rvTBIoxVJTodhq1kEM3zeDkb4s95ho4mfyj9corgG/DAM9Qn/wfmm0YE1v/ X-Received: by 2002:a17:906:76c8:b0:99b:ef1e:3836 with SMTP id q8-20020a17090676c800b0099bef1e3836mr7941585ejn.9.1690807703934; Mon, 31 Jul 2023 05:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690807703; cv=none; d=google.com; s=arc-20160816; b=ieNJ8AjpuMG3KYIFYiF+GywXiNc++IDBNX9C61VKNb0k9sCe+4TKE0zv6iXcnzz57K Og9WAulMrN3MJBksoIjig8+yBVvexuy5gwh/mRpyJrxaRLwv9T1lPuZ6EQQ4EN5GLXRA rDMxglfRpxFYEC9s3P/Py6d+0tzn62Auka8+BLq/JlV3ez+NdspVmd0V4Kz7kPB+fINc tA2rcf9flxnF/xkJj5cXhad/AR4Xd2vhgUdvS+bB9gcCDrxHLpGJVoZy4OiG7oU1eU+a IKTyeAknpd7ILwVaZu2TKZnyT2ftuoGOw2sWncu0HdEeFWNdDQ79XER+0luNFftH171x ejxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=LCpYK27qhQo8VfqcAb5QKVPpewEscAlAuzS6my0qS9I=; fh=6U5kMr9WsaIPulD0vmK7Vi6vsoc2e89GVYF2val76Ys=; b=UPhqnuMHg+W5DW2RUxuaiNz0WeUDlmGExJ5rZjRjrcniGRFvQTv1i1uFaTFBc4AJyx pQB1ivBhXyi40To+u1gJqwFCJtvOAq5pke+tWDwr/O3QIocLBPVU6XFxFm8fXIxIUkii AfnvEq0Yizp+KHug6Sn4GPEbwPXb8RRKgk0cPacn+aF33gXhsk08ZpA43TuYZnwR/ybH DFPBPffnTyrLUC3UoUklVLVUbA1lZNrgpLHd3ut6Z5cpWBYdBlh/PBx9Ndgd0NQols6v ulm/XHDp8yX2sh1G24Dzb3Ge4WfNGkn0tx0QqjBrguZjWvbGqEVsZYMfXXT2VWRHNgER WF/Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a170906374600b0099319803901si6541679ejc.844.2023.07.31.05.47.58; Mon, 31 Jul 2023 05:48:23 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230295AbjGaMOF (ORCPT + 99 others); Mon, 31 Jul 2023 08:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231436AbjGaMOB (ORCPT ); Mon, 31 Jul 2023 08:14:01 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16C8810F5 for ; Mon, 31 Jul 2023 05:13:59 -0700 (PDT) Received: from kwepemm600013.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RDxsw0JkVzLnhq; Mon, 31 Jul 2023 20:11:16 +0800 (CST) Received: from [10.174.178.46] (10.174.178.46) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 31 Jul 2023 20:13:55 +0800 Subject: Re: [PATCH V2 4/5] ubi: Reserve sufficient buffer length for the input mask To: ZhaoLong Wang , , , CC: , , References: <20230718085119.3885747-1-wangzhaolong1@huawei.com> <20230718085119.3885747-5-wangzhaolong1@huawei.com> From: Zhihao Cheng Message-ID: <412c027f-a96c-6de3-f493-749566e8c3ac@huawei.com> Date: Mon, 31 Jul 2023 20:13:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20230718085119.3885747-5-wangzhaolong1@huawei.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.46] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,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 ?? 2023/7/18 16:51, ZhaoLong Wang ะด??: > 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 > --- > V2: > - A 16-byte buffer is reserved, as implemented by other interfaces. > > 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 016a861c5029..1c3f1a2436e5 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); > Reviewed-by: Zhihao Cheng