Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1073710img; Mon, 18 Mar 2019 23:05:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyO3M+TozEhh5pYG2YzhCWZCdAu2C5+sK+guGcR02KTh3LPDMAz67/ad+pePZvMydkNASwS X-Received: by 2002:a63:f555:: with SMTP id e21mr245977pgk.71.1552975516965; Mon, 18 Mar 2019 23:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552975516; cv=none; d=google.com; s=arc-20160816; b=TyCHHH0ny53ELygVj71kZPw3TymhbdU5R21EwNyQTpgJ4+Yl5YZ0Ifq3isE/fLa0nf x3YrjsGAvqkHjTQu3MfZ0fpQ0dvHEyoxqOUbJ6KlfqcyOAXhVIV+EIx38AWS1KV0nSqS oTu6MFpYhoUQsyG+iOF4ES09wJmpBSTj0WEHWlW5sgQ0Qp+XtWE4oYzUHwWLqpvriEej wGKxJ5dJJXt/lH/9OpSmBO6PXgJrs569BuAYBq1awI8eexuiAJ9GmU1gD3a1HLO+cw3X IjhoKMxgdhSHprdO0NKGWZ8uo+uXnfNEmnRgSYvjzt7FxjZSLzeaI1ULdWTMtz5jOmAn +HOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=KpKNLfJbRfVLj5zuuXFzuwLPUt/VYjEN4fmKtgg8KZQ=; b=to/jKqN/XyIYMqEcYucrgPbRlhp6HeQr/PmuKusjuQ5Etwzc2U9byh+izTkERQQfro UUC1QPb0dHUbdCzgTUmIp5YTn7Mf3Q5x3yIyL0/c/Y01pB5lp9hw2MZJ0WszOiIxFG8g 9E4xOfvyw5kEUpnV9cZn7ocySissyIWRyScft0oOgAa2e5fDPUuADjKVqo3sR7uYwaWK S3SzdxY2dfT8VK0YSlQBOpL7Mkke/BbV0LfVWXi2fk4NkB/L/M/1ycC8uYG9dyDnTyLl j0KDcArQw+YSp8CLELn7sh0iIO5q0ZKXAFdDX/tecO3UYmg4kO32pHjEOjEqlNIFccJU tiTw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p17si10834219pgb.329.2019.03.18.23.05.00; Mon, 18 Mar 2019 23:05:16 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726506AbfCSGEX (ORCPT + 99 others); Tue, 19 Mar 2019 02:04:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48800 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbfCSGEW (ORCPT ); Tue, 19 Mar 2019 02:04:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A98E6C057F5C; Tue, 19 Mar 2019 06:04:22 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (dhcp-10-65-161-156.pnq.redhat.com [10.65.161.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8561F5D9C8; Tue, 19 Mar 2019 06:04:17 +0000 (UTC) From: Pankaj Gupta To: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: amit@kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org, mst@redhat.com, pagupta@redhat.com, siliu@redhat.com Subject: [PATCH] virtio_console: initialize vtermno value for ports Date: Tue, 19 Mar 2019 11:34:06 +0530 Message-Id: <20190319060406.26863-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 19 Mar 2019 06:04:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For regular serial ports we do not initialize value of vtermno variable. A garbage value is assigned for non console ports. The value can be observed as a random integer with [1]. [1] vim /sys/kernel/debug/virtio-ports/vport*p* This patch initialize the value of vtermno for console serial ports to '1' and regular serial ports are initiaized to '0'. Reported-by: siliu@redhat.com Signed-off-by: Pankaj Gupta --- drivers/char/virtio_console.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index fbeb71953526..05dbfdb9f4af 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -75,7 +75,7 @@ struct ports_driver_data { /* All the console devices handled by this driver */ struct list_head consoles; }; -static struct ports_driver_data pdrvdata; +static struct ports_driver_data pdrvdata = { .next_vtermno = 1}; static DEFINE_SPINLOCK(pdrvdata_lock); static DECLARE_COMPLETION(early_console_added); @@ -1394,6 +1394,7 @@ static int add_port(struct ports_device *portdev, u32 id) port->async_queue = NULL; port->cons.ws.ws_row = port->cons.ws.ws_col = 0; + port->cons.vtermno = 0; port->host_connected = port->guest_connected = false; port->stats = (struct port_stats) { 0 }; -- 2.20.1