Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5533683img; Wed, 27 Mar 2019 10:12:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7fcHpvHCdUzOYry+PlC6bN+baJyWjFKZ051ttsBWS9jiU6u5YywAI3B4uIj0bGAJKjboW X-Received: by 2002:a63:5b4b:: with SMTP id l11mr35282124pgm.82.1553706720865; Wed, 27 Mar 2019 10:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553706720; cv=none; d=google.com; s=arc-20160816; b=BZ5oBZRqcJL38Mk/2Z5Bpuf6lWQGG5wNzq0WBeLWLmVyU0E3CcHObzopGD81HEIogD KVXd2yi1DJcbGQF60oqPn9lNlYZ2s27YQ9yI++aUBYjpAp5P2gQUSPhBe8gfZsh/hcAd oBM8j32+iJ8XYgTuAtqYkmIkKN53c5Y1Frb5ls/CZ30BP9I2+ZqMZWO2KitEY/M4Q7Y1 hF1L/nvhx60RnVnBLijKknwSI4sSTf3E54Hl+gStESRiyUN8Skdx6RDAADdFq00BgfZ0 K1q8jYcTab9KwkdtkinIx4C6Gk3SqupedEMsHZjEyRnZA2I7mu3+wx/bqCsvj39D1DAw gpxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HaYG3Urew4OVW3qYddWpvb72dK52f/h7DEtTWkLewsc=; b=0UYY1CfUXzbEypfJBdgcfONBxJ2UWbNqacc0S/JchZmVRuwjxYsIXo0q62KiK5EoR5 qOus9jfaKW4gC8h4SDqp5PRtKcfUnU7XPQCBbhL4jfadHiLXFFHu+QN8Z+HbXxotxEOe wXLzU0qIgnxugr3mIFtlva7qDuaIVJ/0fUX0cw3Y036T2bjZF2geWL4HUDtt301pgYtw gGWzf6sFhKfDGu8pCJpNU2Nx9p80nZXM0jDns8CmfdSYsfAElHnH3TIHKWZWf+HTST1t Vl1SXUUsaPeseyzTFid23RDw+sJM9R1vZ8YpUJOsTCefaBAIdU5Cs7L7UpIyI7k50ql2 UUYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zt02eZLz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si8944793pla.243.2019.03.27.10.11.44; Wed, 27 Mar 2019 10:12:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zt02eZLz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728221AbfC0RJG (ORCPT + 99 others); Wed, 27 Mar 2019 13:09:06 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:40643 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbfC0RJF (ORCPT ); Wed, 27 Mar 2019 13:09:05 -0400 Received: by mail-qt1-f194.google.com with SMTP id x12so19717952qts.7 for ; Wed, 27 Mar 2019 10:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HaYG3Urew4OVW3qYddWpvb72dK52f/h7DEtTWkLewsc=; b=Zt02eZLzvyhCzgcyfOCuXWgb5LFJOrKhunf2mdDI8EhXMf1hWEjRfjBPwtCzvX2XIn eIS43V3oeR/XwxnmvBRYR50j0BeJVcOFChzJtKcvvQ3Dm1WCgKVKRCKkVTanyGxst3Ck U8jEHddZDJQZxebsPB3ryWfgFR4uAPFNliM/zpBmYcOYeio3dfUe8m2mihnljnDehXnn hUC+OEzfM3P8sQA/dSNC5OkWHpYb/JsxPCzH50RQFA6Q5tnQtCoO1kVG39I6O61rTgT4 RkgJ94YYMi+wCvzje62Ilqfh9ADMgX5056DeVsZzIwIsO5eyfFOtLWm8lbUfZNnt0kFP ib8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HaYG3Urew4OVW3qYddWpvb72dK52f/h7DEtTWkLewsc=; b=sZNz+Td5o/s0YOCMCZsDtI/8H+ONAU5/NXIrCHzsD/6fwabDOnRvga/zrebMs8WKij xem7G6cMz7Jhfpm2rNBhZLsC/5hHRsjd8IEWDegfw44Ur6ilHlWLqNKV/EXlyBbhrjeo qEH91ucY5b7BJaGq5YmFsaVENrIh9cAWXIoq2uiayUMTX1M8y52Y5WA0el3qvjxgHQe9 +JEG+fvvOjZVFTHIvyq/Kh1adkKnVWvG8JzcqU7WgakvCoIsn20kKBlwCAgnjUnc5rRF 5ae5uvGzyKEEcLjLLuonpMUpAhCb8RIxGuRjrdURj0+FZzrMhbt0R97Gz0XK93EkeO5l g4NA== X-Gm-Message-State: APjAAAXbSE0G+a/Gdoc0gcrNMYR//BBGdiZOayOafb4O2yYTaJuhjRaa pcXm/Hh92DmQfPDC4S6MdwLjBswno2bxG1DkF6k= X-Received: by 2002:a0c:96eb:: with SMTP id b40mr2477600qvd.131.1553706544769; Wed, 27 Mar 2019 10:09:04 -0700 (PDT) MIME-Version: 1.0 References: <1553648174-24913-1-git-send-email-v.mayatskih@gmail.com> <20190327164914.GE27283@stefanha-x1.localdomain> In-Reply-To: <20190327164914.GE27283@stefanha-x1.localdomain> From: Vitaly Mayatskih Date: Wed, 27 Mar 2019 13:08:53 -0400 Message-ID: Subject: Re: [PATCH] vhost: zero vhost_vsock memory on allocation To: Stefan Hajnoczi Cc: Michal Hocko , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 27, 2019 at 12:49 PM Stefan Hajnoczi wrote: > Which field was accessed before initialization? > > I ask because the situation is now unclear since code remains that > assumes vsock is *not* zero-initialized: > > vsock->guest_cid = 0; /* no CID assigned yet */ > > atomic_set(&vsock->queued_replies, 0); It was hash. > If we're going to zalloc, let's get rid of explicit zero > initializations. Or let's use kvmalloc() and fix the uninitialized > access. Mixing both is confusing. I would go with zalloc, since it's easier to read and it prevents further situations like this. A zalloc was there originally (not in fallback though).