Received: by 2002:ac2:48a3:0:0:0:0:0 with SMTP id u3csp563549lfg; Fri, 11 Mar 2022 13:24:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJyb3AP5Kef9Yo6DkLxjG0JBdsT/fn0Q971q8FzcVMH1sAJcO+BcSgZhjVenmL76BF7F78fX X-Received: by 2002:a17:90a:4809:b0:1bf:72b5:af9c with SMTP id a9-20020a17090a480900b001bf72b5af9cmr12847073pjh.190.1647033849721; Fri, 11 Mar 2022 13:24:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647033849; cv=none; d=google.com; s=arc-20160816; b=zvUbbsT/8VxFs5t9CpJbEq3r0OnaT09sAypsVi0S8SvGjkg/sSX0LV4Ey5ifS9sCro 2eGOSqN/3sEB0S78TO5h6qiVsYl2qvZcMeg4YRL4/QUESwstRgK+zS9C+a80X7ejQZxz JRufzahfWbOGOpelBtyAVM+I3R58QASMOVh0jB/9lyc3U19xeT2ORZki6KnTCtlQNsoF ZV9/u8brs3Iv7SnoOgc661Rq8+ioRFa/ZJLxh7ug3/FpBGfYTVj8j1HvaI4SD3vLOIA7 q/ZcHT14e0vr276Y2CtZbulrJ4vKusnhfLMsiMNdd/LuUm9QGpVROz7lORpUJfiABNRk 89ug== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=8Ji+Sz/InlU6NQ7/bE8a/j0QT0u2BBcoHxouEcw237Q=; b=ZJGX5mSUZOidHey//EdtxmYGIIbJR6kVHPGyxCL3pEVqIAEqkH1EzfO+tYzZRSRF4w +aLY3UcqOiCXmRNqyYQUpsqDj6DDa0NVXDQt4dehFy3YVy7sprcrhTufscjXwn4+FvtN 5JuX05L6vvc4R3x+jMwE0yPXl7ntuQtmJZBuOnjqU9uteUEcuF57n7kWN0cCvLZtuRjX 12ZtPBGumUQH2z3wA7NzUYVYYg3rhLKylFudj3Z0RdCeZaYeDmn9j29HTjXrOJpJYQV1 XXhKKdGLGetZmkCouIQe8UrK6klTbkI3XmxPbG3Mv+nIIaPttzTUJ3mX5/SQIekxgxJZ 8l5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=1ZI8yU4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a38-20020a056a001d2600b004f7283479adsi9019430pfx.92.2022.03.11.13.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 13:24:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20210112.gappssmtp.com header.s=20210112 header.b=1ZI8yU4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9703A223202; Fri, 11 Mar 2022 12:59:25 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345845AbiCKDBh (ORCPT + 99 others); Thu, 10 Mar 2022 22:01:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345886AbiCKDBe (ORCPT ); Thu, 10 Mar 2022 22:01:34 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B4921A8CA4 for ; Thu, 10 Mar 2022 19:00:28 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id 15-20020a17090a098f00b001bef0376d5cso6961345pjo.5 for ; Thu, 10 Mar 2022 19:00:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8Ji+Sz/InlU6NQ7/bE8a/j0QT0u2BBcoHxouEcw237Q=; b=1ZI8yU4UrELG2xrC/mfVd6A+FaeFF+xwtztLkZtCvmLCL9ZEErSZpHk7iQwh9qdQJj SUBcUc27Sn3R/NDBARB+reFk7UerEKN27Xn5YWdz6mz8Jkos8eGNMf+ibZAcuuIh5TM1 p5deuroKIfLra3z9yBeBmKSt91D4QZ23PgzE84zPNcgGJZ4/off5QhP0PkuaSRnlVMhw inxMAToYVOeyAlvs043dpXiYqDF+T2B2necAj66KcoyJMwxg+owdBtezDI376bf51u4e xWC9bvDsuaTmpexOzT7M7beDXBJT7IR7F732Ylxj56jsBX0jM3y1RZnzT9o9LHQvHo+g xfdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8Ji+Sz/InlU6NQ7/bE8a/j0QT0u2BBcoHxouEcw237Q=; b=gfLILNzp75h580XWNVbRe2udffsh5K84AY6cUTRWkmG9zW9rlUrQlxWbzcgP5haJWj mUmq946PWQ3URQUkRTM8zBlsUXSE9FshQO63VjPVEr/+kBBpAB/oC5A5mnR0eRkxeBzJ BCRtDPmb25aVrd8AFyELrU6V/HSu2QmCMT/1an5ss7+JrlkvMCzfRpoWgaCitEhJU5f2 cPFZU+4cqjeN24eBhB+Cs040qHybHADfoYf2L22P0nAVo1h/5AgtAaFnCHQkeqQLOS5p zgXQ7EsPlPbc/4xRf/RDIIORsRJjDRSfiPFH9uv5IQQU3WKIlECmWnlICve2AKTEn5J1 NyEQ== X-Gm-Message-State: AOAM53355EHOxujgBGB+UTgs1kpw9yRtgWa3uo2rzTVjqSk68wQfKUUh zs/m0CmaNUiau03lQ5g7Q77KHg== X-Received: by 2002:a17:90a:c504:b0:1bf:6d9f:65a6 with SMTP id k4-20020a17090ac50400b001bf6d9f65a6mr8653580pjt.204.1646967627714; Thu, 10 Mar 2022 19:00:27 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id u10-20020a6540ca000000b0037445e95c93sm6673005pgp.15.2022.03.10.19.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 19:00:27 -0800 (PST) Date: Thu, 10 Mar 2022 19:00:24 -0800 From: Stephen Hemminger To: Jiasheng Jiang 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 Subject: Re: [PATCH] hv_netvsc: Add check for kvmalloc_array Message-ID: <20220310190024.0eaa76b9@hermes.local> In-Reply-To: <20220311024344.2037906-1-jiasheng@iscas.ac.cn> References: <20220311024344.2037906-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 10:43:44 +0800 Jiasheng Jiang 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.