Received: by 2002:a9a:4c47:0:b029:116:c383:538 with SMTP id u7csp1203789lko; Tue, 13 Jul 2021 19:30:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTOeKvJYbBlKUywRemcmDyVZ8C/avqLEVerVBCgVdAVuJACsucVEW5wVgor8H3wNTWVNM0 X-Received: by 2002:a17:906:fb15:: with SMTP id lz21mr9242190ejb.521.1626229857365; Tue, 13 Jul 2021 19:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626229857; cv=none; d=google.com; s=arc-20160816; b=wCUjS90pXO+KxO13HSA+vmqn/WM5y3SVDYpqmWwbhkh2RuquwBVVRh6e36w/Piudaf So8CgvS5IgHSEVfHfhjvzjGKBdjtsSLkFYAg55z2J4ONM6SH5W8uX8sglXdNMQashnCB pOV2JKHW5q2+OrooUEPvhwNBxhwqhrTxYIgA+dMqbzaqKWn2mLu4Wglyw2xzLEvZIP5q M8IQYOux4F7dLncgrs1jfrf5lzinOw/UmzHKGqoL9iMGwJ3Kjkv+u3OvzxSwV7Jl46EX b7Atm1gOrTXNT068QC4juD+Jcx6UihOK/NcbiL7MP4YQPXyjjt2ZBBtKXlOV+Z0y7lko ZXbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Fk+wFY9uT9QsFHzxvX10x+rcFOEOERwn4ePlm+QcYFY=; b=vqpyeKOSaAdqwwdPHAUxtSzvpYyPCseYkFL04ZgAiVnkdAX/WvFVNqqK0j6HphkXe7 j6dWwdDD2s/krprXeot07Ck3xxcL0TNxF2ycI1kmeHeE7+QykWI5FCRiKxcVPfWzzwZJ v9L9keQdTOe5yI1rgQyHx9cDn9dIbqyOs49WsQqGpeoZD3hSDnb3B6oOHGTtDz1Rn3td dnHDCIelR/QVbR5JA7edNG/j+RZOuYX63g5PDz4lX4x/Hw6S98/fWyTsbxYpecAAlVT0 4hTm0fxore22Q3QwfW8D1xNHdaMenfjItwE/Lnm3QRFe9wfjT5vPjTLRakxdN04ZU7eo tC3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id my38si787877ejc.602.2021.07.13.19.30.30; Tue, 13 Jul 2021 19:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237422AbhGNCcF (ORCPT + 99 others); Tue, 13 Jul 2021 22:32:05 -0400 Received: from usmx01.baidu.com ([12.0.243.41]:36328 "EHLO baidu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237631AbhGNCcE (ORCPT ); Tue, 13 Jul 2021 22:32:04 -0400 Received: from BC-Mail-HQEX01.internal.baidu.com (unknown [172.31.51.57]) by Forcepoint Email with ESMTPS id BC7D8C3915508456CFA2; Tue, 13 Jul 2021 19:29:09 -0700 (PDT) Received: from BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) by BC-Mail-HQEX01.internal.baidu.com (172.31.51.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.10; Wed, 14 Jul 2021 10:29:07 +0800 Received: from LAPTOP-UKSR4ENP.internal.baidu.com (172.31.63.8) by BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2242.4; Wed, 14 Jul 2021 10:29:07 +0800 From: Cai Huoqing To: , , CC: , , Cai Huoqing Subject: [PATCH 2/2] virtio_ring: fix error - 'prev' and 'head_flags' may be used uninitialized in this function Date: Wed, 14 Jul 2021 10:28:54 +0800 Message-ID: <20210714022854.1077-3-caihuoqing@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210714022854.1077-1-caihuoqing@baidu.com> References: <20210714022854.1077-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.31.63.8] X-ClientProxiedBy: BJHW-Mail-Ex16.internal.baidu.com (10.127.64.39) To BJHW-MAIL-EX27.internal.baidu.com (10.127.64.42) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org when run "make virtio" in linux/tools, the error: "'prev' and 'head_flags' may be used uninitialized in this function" occurs Signed-off-by: Cai Huoqing --- drivers/virtio/virtio_ring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 89bfe46a8a7f..290bdf8a3d36 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -486,7 +486,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, struct vring_virtqueue *vq = to_vvq(_vq); struct scatterlist *sg; struct vring_desc *desc; - unsigned int i, n, avail, descs_used, prev, err_idx; + unsigned int i, n, avail, descs_used, prev = 0, err_idx; int head; bool indirect; @@ -1173,8 +1173,8 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, struct vring_packed_desc *desc; struct scatterlist *sg; unsigned int i, n, c, descs_used, err_idx; - __le16 head_flags, flags; - u16 head, id, prev, curr, avail_used_flags; + __le16 head_flags = 0, flags; + u16 head, id, prev = 0, curr, avail_used_flags; START_USE(vq); -- 2.25.1