Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp839907ybn; Wed, 2 Oct 2019 07:02:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdX8qQo80AMBPn26129gSA40oRWNCS+T7F9esY/pOUsjE4uz2F1w96Sa5Or/MTjnvj8aPI X-Received: by 2002:adf:ed8f:: with SMTP id c15mr2866957wro.83.1570024976670; Wed, 02 Oct 2019 07:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570024976; cv=none; d=google.com; s=arc-20160816; b=mW+2FvZ4/CLVLMUsKmOu496oar40BuXdtTZL8k4cuQ7+dMdNdoEx66GUReRXxL247c 7t0IwMHwbnjPUGBPplf4kykhTNu6zJhIH+wh+9rLuDCEhRuLZcZeVBP/Sh0SMsF2saAE jW1ueF7qhzdE7FfgxiDCi2pMP7sqnnsYjzcYhrTrljsTci5Qnk9XeuVrDYC6GcoX4s24 XY7UkMPaYrkPrWm4/Ojl4f3Mje1nzCMQqzTR1dDzwC4CLlp4FAUEVuIPu44O56wCllG0 HuQX8s1cy0rNV55HXSb8wu//Qjbh3Y7s4RjyWrqInbkH/UcTTvrANBhU1AsFiQW0lp6A yJyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vhowmgkseytW1pHuL0lgJJtUtqRUC7YPO7Hg/w47jj4=; b=phTvxTX3t56ChxaWifBDNwc00lqjw+Y9nBCPdO148CuvDxsO34BFsoic3f3PV7jc1F yMJbWV58XL4fFxDqG0WLH9obn64oZAY/TLxNkjKw/RhR/+mjRbsRTyHoulKLJLgoQ+a4 Aoe6soZaVT6/tsx2eB7fFvFHGuH5ZahdeeIAOLNpngwcg6RQH+QmysQd1WO/Y8d+ZdLB AZUSRPJLZJZzttlkNoPfg3hyxgyDkbSOf+xNJytC6MAi9ALOszUjirJjnTVppPUwH6N4 X3xeAbtQ7rYGfF3wsvm2b6FAzG3JdYfXxwi5i/KeI7VBwxzWIxGb4Tkr3vU3/TWF2SMh 6S5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=f5Z+M3Tl; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b44si11255531ede.451.2019.10.02.07.02.30; Wed, 02 Oct 2019 07:02:56 -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=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=f5Z+M3Tl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726574AbfJBOBn (ORCPT + 99 others); Wed, 2 Oct 2019 10:01:43 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:41505 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbfJBOBm (ORCPT ); Wed, 2 Oct 2019 10:01:42 -0400 Received: by mail-qk1-f195.google.com with SMTP id p10so15057917qkg.8 for ; Wed, 02 Oct 2019 07:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vhowmgkseytW1pHuL0lgJJtUtqRUC7YPO7Hg/w47jj4=; b=f5Z+M3TlEajM14Is5sfbCMdOd2HhlK8i0KmSIAeMyb4aLvRrtXXEXq5FqOgrAJSK2T yAbPBmBn+avTkNPz3tQSGYBZSqdBA1rFyoQ2/yLZbskpWBhmDEbQwkiAYWal6vzP86Ow 2iQ2vPs3n+zVFM/UxyNyxEtgUlpfRJ7DyDfkMi/dr9kSNey+knDX9zA6Mv2iZk0rgo4Y pQ6401zA76ug5k1YbtCGXoJJ1TZoHrgVVJlq0A0Fj41rpfwWmnAIkIE7Zidhs10WADig X1IIzF5d3wzTBNiyEt/bYkQ0vvZdRmh7iTmvfq9ctSo73YK1oxqsWkibC0TyZxrx03hb HsFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vhowmgkseytW1pHuL0lgJJtUtqRUC7YPO7Hg/w47jj4=; b=i1EdWJJnavM/mIn5CpaMdKxf0KRUMbiGwxMNDFdwybr2FwcfNo3wefF2Ro9OTLlLR+ 7c+TeWcYYuO2BG2EXiJ/Yy+3w2dwnghexs/fgumS+egiV/mSXVd0AdQup7lJZgwFbWRT olpjfVDo9muC7xdlvy1HopL8XJI9PLhCV320Pvobfj/wvxWmfN+A5lSYupxTL0/yNijw 8xbh8EjjgZkTPcJzBtFsaDIhUg70qOS8sFaVuOJy8pY9hbgigCJObg1fR+UVlR9pD7ML vDgKZoVNlaurc02/q6QQpcLPXxrJbDCM1SRWqPvHZIiDSWSHK/+yCEwS33bUWPM4jdPG 4Yog== X-Gm-Message-State: APjAAAV7KfGrPimSiyZf4Y6a2WVKhOWw1SUEYtwKdreqhj24aI2Z5GPD SrcwG9JQekr04in5+9GORJf58A== X-Received: by 2002:a37:6713:: with SMTP id b19mr3658748qkc.301.1570024901663; Wed, 02 Oct 2019 07:01:41 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id p77sm10127501qke.6.2019.10.02.07.01.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Oct 2019 07:01:40 -0700 (PDT) Date: Wed, 2 Oct 2019 10:01:39 -0400 From: Josef Bacik To: Colin Ian King Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, "linux-kernel@vger.kernel.org" Subject: Re: Btrfs: add a extent ref verify tool (static analysis bug report) Message-ID: <20191002140138.eug7xvwhlsn5qnby@MacBook-Pro-91.local> References: <3d1bcdce-16ae-d490-0a68-19d9d9d41d92@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3d1bcdce-16ae-d490-0a68-19d9d9d41d92@canonical.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 02, 2019 at 02:50:51PM +0100, Colin Ian King wrote: > Hi, > > Static analysis on linux-next with Coverity has picked up a potential > issue in file fs/btrfs/ref-verify.c, function process_leaf() in the > following commit: > > commit fd708b81d972a0714b02a60eb4792fdbf15868c4 > Author: Josef Bacik > Date: Fri Sep 29 15:43:50 2017 -0400 > > Btrfs: add a extent ref verify tool > > The potential issue is when on the unlikely event when all the items > contain unknown key.types and so ret is not assigned a value. Since ret > is not initialized then a garbage value is returned by this function in > this unlikely scenario. > > In the previous function process_extent_item any unknown key types are > flagged up as an error and -EINVAL is returned. I'm unsure if this kind > of error handling should also be applied to function process_leaf with > invalid key types too. > Thanks I'll fix this up. You can run into block group item key types and we don't care about those, so we just need ret = 0; Thanks, Josef