Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp527747pxp; Fri, 11 Mar 2022 09:00:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBUPyQFFjiYIWQOgUqV7wGx7V3mb3uIMwLqEJqDDL0PEDKT8cTFnQpZLhAypC/B3CwJ6XD X-Received: by 2002:a05:6402:2915:b0:416:cad2:d619 with SMTP id ee21-20020a056402291500b00416cad2d619mr5172283edb.221.1647018053537; Fri, 11 Mar 2022 09:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647018053; cv=none; d=google.com; s=arc-20160816; b=n4jRMhfLuYtRFwp4VydaqsbLq+JsHbWMUUY6jgJTh94oQCx4u2ZHKPobDoi9pfIyS2 yP4YDR+zEuf4Nn5hOT9O3sq8mo8023AuNnNI5l2anoaP+17cJ1FwROS14B8aINxB43Si JLev0aiEJhqkfOt2BZJ+h60DdDNzOrtB/W1Pyp1rYyBv6s+oTXqS6zeKPh5GrRpNXspR 0UIVOBplUXRCEXjdiNkPhLn20ccMHwV25YdOeVYWwA0UE9lmipU9ZXBuHJeyVm+ATz3B qbV+0ptr45Lu8vcTTMrZMOkgD5G0dejpovY3Rm3oAHdRpIxM2qCN6vvxJQBxheRT6dtk 4cnw== 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 :message-id:date:subject:cc:to:from; bh=LxtkO8thMOv4KZYi3ikHLD9kGQgDA5hdC5JwoAL4qcM=; b=h5AeUl/gBoFYWkiXqWfycZQA5eTtETso4KGM+Ebl6BxzKHhxsWIwjbeOLf8LhpFdaL Uft/eSMPXVTf5oexvOMuDakNrBEfmO6azBJA3Xrbk6zL6VvBmu6zc73AzAPvApVIAmhD CdkrvJck2904fP9WToC6JuM38HLHE4A/AZybB1MBgDIpAMwt9pJUxDMMz56uVDAAIAP+ mR6wG6EqDo10c5jrS7fGVchkXKoanaL/a93AOWRutyboCwJUq2m6MVO6o+LR5E51P1OT Khht6WXlji4qx2RG9+sG/s0dZM65GsAJKoCIxt9BSaa0ShFdNekwEk8bdf/BHwyNPSTx KM8Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id er27-20020a056402449b00b0041622779c54si4949176edb.624.2022.03.11.09.00.24; Fri, 11 Mar 2022 09:00:53 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345849AbiCKDWU (ORCPT + 99 others); Thu, 10 Mar 2022 22:22:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345775AbiCKDWS (ORCPT ); Thu, 10 Mar 2022 22:22:18 -0500 Received: from cstnet.cn (smtp21.cstnet.cn [159.226.251.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9216E1A8067; Thu, 10 Mar 2022 19:21:15 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-01 (Coremail) with SMTP id qwCowAA3PvocwCpieagEAw--.41793S2; Fri, 11 Mar 2022 11:21:00 +0800 (CST) From: Jiasheng Jiang To: stephen@networkplumber.org Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, davem@davemloft.net, kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, kpsingh@kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Jiasheng Jiang Subject: Re: [PATCH] hv_netvsc: Add check for kvmalloc_array Date: Fri, 11 Mar 2022 11:20:59 +0800 Message-Id: <20220311032059.2038014-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: qwCowAA3PvocwCpieagEAw--.41793S2 X-Coremail-Antispam: 1UD129KBjvdXoWrCFWfZF17Aw4rKF15ZrW5KFg_yoWxGFbEgr 9agr1kCa98XryYva1UZr4jvr4IyFy5Zr1I9a1kX3sxZ34rA3y7Wr1kKrsY9FWxWrWFkFs7 KFyay3yvq3Z0vjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbVAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Cr 1j6rxdM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj 6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr 0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E 8cxan2IY04v7MxkIecxEwVAFwVW8GwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbV WUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF 67kF1VAFwI0_GFv_WrylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42 IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r4j6FyUMIIF 0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxh VjvjDU0xZFpf9x0JUg4SrUUUUU= X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 On Fri, 11 Mar 2022 11:00:24 +0800 Stephen Hemminger wrote: >> + if (!pcpu_sum) { >> + for (j = 0; j < i; j++) >> + data[j] = 0; >> + return > > Why is unrolled zero (memset) needed? The data area comes from > ethtool_get_stats and is already zeroed (vzalloc). > > > There does look like at TOCTOU error here with on the number of stats. > Code doesn't look hotplug safe. > Not sure, but that issue might have been raised during review. I unrolled the 'data area' since the three 'for loops' before have already assigned the value to the data area. And I have not found any review about it. Thanks, Jiang