Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2671133rwd; Mon, 22 May 2023 02:25:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4i3s7OoHIgKrt5BQxIEabXRgfi0uFU8TgE15cZQUNjajgjlNVcfL8dCXkb91pL1IhLnvij X-Received: by 2002:a17:903:22c1:b0:1a5:167f:620f with SMTP id y1-20020a17090322c100b001a5167f620fmr13034014plg.15.1684747512890; Mon, 22 May 2023 02:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684747512; cv=none; d=google.com; s=arc-20160816; b=mqEk1mTRMcKsWDWXEtp+HdqlrtVR9u+Tplv4HHBo1Hn++DS6SQWOg9g2r3P/tELMKI UJscPrh29zVTIA4/uuxeeDJMozhswEIDDfNvoT4rV8py58kv2Wv6Si/54nLLEEFwddUT 9k6oMUdr/ZATpT0CHvnLtn86bGOX4Oh7mQkUBf6t1+2ymtTmKnJHLsOJ50DIWezKfIjm yRMKKr7GjgNFuASE/pOX0A6Hup0c7uqFuux98Vjy9cWJoODRJRd11S+siBBHQQzHt+FA bJqtfayfR0W7gv165cjukn79SAq0SOpvYEeyvqbryHt3v5k2Tmgoog17EfxiEeSz8eji /yHw== 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:dkim-signature; bh=NJhELKwtMjd03gNF7KmpEmVCJma8B6XT7EEG5otj68M=; b=TaOyyiyi2Xu5TmG6OZ4uPNEjnmKUPKJpUcZ4c7Zf7XaBlHOLD4TDoeRlqZ2Dy/kueE 2jomrmkwg9N7xouP9gEkO5zKYVoABPF25yZBo6yLnOUjTs3DMIrl0g2WCw5YZz50Mdrf 2MKZgS4JPODl6uHST+RAoBv9Lya9YDnwbgBjX5s9+Ht+BdUedOfiDHwDgsfxzCWGn4Lv NnK7Xf3k1wAU86qOgrGyhc4PSaD6OAXk2v+vHRg4fwfsWaUJb1pPVPIjIqPeSUrmXLO1 PQox9Sdlbas0LJZYk/T8wFhDvEotuWEVyStfAwSqtZxCxZJHdsOVF+FJ2y3vvDOdLAjn a20w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ApcHDbXT; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oa9-20020a17090b1bc900b00246a6cecff8si4784513pjb.44.2023.05.22.02.24.57; Mon, 22 May 2023 02:25:12 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ApcHDbXT; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232449AbjEVIug (ORCPT + 99 others); Mon, 22 May 2023 04:50:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232443AbjEVIud (ORCPT ); Mon, 22 May 2023 04:50:33 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC75ACE; Mon, 22 May 2023 01:50:32 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-64d18d772bdso4961341b3a.3; Mon, 22 May 2023 01:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684745432; x=1687337432; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NJhELKwtMjd03gNF7KmpEmVCJma8B6XT7EEG5otj68M=; b=ApcHDbXTiygQvtexd+vH27HcMnwm6bAyv7n6XhOBgE++bWis9vPRqHRS0W6qj5V7DR mL5tEC5V7b7/FTroGNrJMazKDOznlB5qH/axuJJeAgq8MC0+ykmqNx5K8iUbqTN3wuRq PPSaBggEStKjiLJP/tUl1j7ogRWr0hYF3m9KDRsVamU7UsFj8kaAeBVE09hT6s7x43is HqyQ5pfLphm3MK2dL6jdmiGUxET985tsdSBN/vCXQmh8NGz7pIXzdj10SBZ5Y0R4J5gB X84ThREsJJGV8FfhQQjm4sVUphClHcb+Edgn7WKcbhuDILxuGPF8UtoSSov/vwb79hvQ haDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684745432; x=1687337432; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NJhELKwtMjd03gNF7KmpEmVCJma8B6XT7EEG5otj68M=; b=U7ZUpx3/MTHXGDCOli6HWhaAQ3XD+hm00wI935krr5Qyq7xHPT44EPCq8sRSWTq2rO Zj2DgZT/B9ntvD17QIXCZ/VvQVakpXa5U5nkyJaHZ5xF/QVy4cjcwemxRkLsBKcJbjXq fVvAzm1Rtsi6CrfCgVmguVkCGDrAEGCiVafvLKb/73IF6ZdbyMw+zP/xLyzWEIqepL+G d6xoJ0cxc85JUfbo13doOJhkkE+5uXjquInBFDk2EJ2yRVjoJAT0e3dHeGiFozb2iNIx /DtDOfgI2eJugdu2p7ZCjeRKvO0L/CEfm9p8TzpbV7xL15+6/vWYkZnpIIiNYEQdNn22 kPvg== X-Gm-Message-State: AC+VfDygYMabSxt09wJZBAvdvg7T7ZJh9JVlQ+67ypCk2jH+hJip3XGv //N0UARjhbFCnBOWQ3AM+rw= X-Received: by 2002:a17:902:e5ce:b0:1ac:b449:352d with SMTP id u14-20020a170902e5ce00b001acb449352dmr12242806plf.61.1684745432206; Mon, 22 May 2023 01:50:32 -0700 (PDT) Received: from redkillpc.. ([49.207.202.99]) by smtp.gmail.com with ESMTPSA id d20-20020a170902c19400b001ab01598f40sm4319367pld.173.2023.05.22.01.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 01:50:31 -0700 (PDT) From: Prathu Baronia To: "Michael S. Tsirkin" , Jason Wang , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Prathu Baronia Subject: [PATCH] vhost: use kzalloc() instead of kmalloc() followed by memset() Date: Mon, 22 May 2023 14:20:19 +0530 Message-Id: <20230522085019.42914-1-prathubaronia2011@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 Use kzalloc() to allocate new zeroed out msg node instead of memsetting a node allocated with kmalloc(). Signed-off-by: Prathu Baronia --- drivers/vhost/vhost.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index a92af08e7864..579ecb4ee4d2 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -2575,12 +2575,11 @@ EXPORT_SYMBOL_GPL(vhost_disable_notify); /* Create a new message. */ struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type) { - struct vhost_msg_node *node = kmalloc(sizeof *node, GFP_KERNEL); + /* Make sure all padding within the structure is initialized. */ + struct vhost_msg_node *node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) return NULL; - /* Make sure all padding within the structure is initialized. */ - memset(&node->msg, 0, sizeof node->msg); node->vq = vq; node->msg.type = type; return node; base-commit: 4d6d4c7f541d7027beed4fb86eb2c451bd8d6fff -- 2.34.1