Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2454687ybl; Sun, 26 Jan 2020 03:06:32 -0800 (PST) X-Google-Smtp-Source: APXvYqxXljUytYv4uCD0aeIXR91e77msz4h/2YNMJi5Y9COWXpbDJOrOLTjseKiFbKEoyGquTOR1 X-Received: by 2002:a9d:4541:: with SMTP id p1mr5530193oti.199.1580036792003; Sun, 26 Jan 2020 03:06:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580036791; cv=none; d=google.com; s=arc-20160816; b=ydy8ecSQc+bGDQBx6iz7gVNbCiyQ5b7Sz03iAOykaME9wK85wC8Dve89AxLBsFHBbv Qch2rTiAib3YvoiKdFzEADx2BWcvZnyrAg1/unkcxQ3D9SjPhQxJYwWN15dSDDzMEMnu BkXB2oHgNzpOgCCplqpYw9fOwghvS3GL43n0eRTAKJUrbxWqOS7wHPIikxeMAKWL1N6v MpBCG8j710AE3fGh2cs+3QjhIrZEl4rr2RhIKgCfuJkYheeW1Lo/PM0dr6LBkuHHHtHf fzOr53IOWoytxqviyxwWCMxJ+BYdFkTObnRQUZ70PGBlNgGj9mDmXmJi5PG9KUWcCj2p RpKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cBEvHipDhASp6SrgrMvSSIKcdMGAZhryboaA8IMUX2s=; b=KDUycyQ1RdIDyoEu+dsLihgxoF2o+AKS1e8LK0ZKa+rh22ZY+ClSeli5A1NbTK4PO0 m2ukC12WGu2z2mI5vmflcFEp7l500jg9qogXjFu+vWJiW46yApIhAXW1x4OUOIkK7Eqx y0BFzsVR42fluouK5ziB08THTWBc4C1l7PP/ORaUrzvVyCHzrQNWP8Fu6F7YXTaz/py3 Gfrnb8+dDUoz2igirstkvO2XmHRoLquavumlH3oTOyEmJsURCmFUTFxZYoX109f+J07H X4f7VojeecMia9UVWebvRkWRmFTMMgnHGppETeGO6ZiOmLQjh30rWbEWtfSxLdHv+Ngo CFDA== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si214615otp.220.2020.01.26.03.06.19; Sun, 26 Jan 2020 03:06:31 -0800 (PST) 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729397AbgAZLEm (ORCPT + 99 others); Sun, 26 Jan 2020 06:04:42 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:34356 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726436AbgAZLEm (ORCPT ); Sun, 26 Jan 2020 06:04:42 -0500 Received: by mail-lf1-f65.google.com with SMTP id l18so4226362lfc.1 for ; Sun, 26 Jan 2020 03:04:40 -0800 (PST) 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; bh=cBEvHipDhASp6SrgrMvSSIKcdMGAZhryboaA8IMUX2s=; b=iftzFnmxssGft7AeIUJwCpLPyoe3xJpPeQkE8sXKfTMHLD9Dj3NyKuyhbFsFNA3ewC w97rDRZzlqLvtoIYGnTSABHlbmp4xnc/QeJFpat736o692vuyVWyY5COL44kI6jpbg5T uwniADIqzjPLE36Rna5bFp3jzaSFMDktix760dzPAXP4lc2wnjxMO7VD6Q8BQNBLah4H dMXUisrHyS/52oAZYj5E26i2dQEq3AYZ0NAnCRXPoZ37HMRQwiWRc0H9qjR9pRADaWBI jYn6P5AtcZMNvdJrI0gXKn7tFFDewxwzHmqYYnvA4/NaKnL6uHw5w95gKcCXd96FvM9S BNrg== X-Gm-Message-State: APjAAAVe47mH/Vo/7Eq/ebZKf8SieYWubxEZvBpX6vcDsKYvI3cyElnA 5cHxP3uF+ZNzhPFKCrzs3Hw= X-Received: by 2002:a19:cb95:: with SMTP id b143mr1425364lfg.158.1580036679872; Sun, 26 Jan 2020 03:04:39 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id s15sm812959ljs.58.2020.01.26.03.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2020 03:04:38 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1ivfiZ-0002mK-R5; Sun, 26 Jan 2020 12:04:39 +0100 Date: Sun, 26 Jan 2020 12:04:39 +0100 From: Johan Hovold To: Saurav Girepunje Cc: vireshk@kernel.org, johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, saurav.girepunje@hotmail.com Subject: Re: [PATCH] staging: greybus: fix fw is NULL but dereferenced. Message-ID: <20200126110439.GL8375@localhost> References: <20200126083130.GA17725@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200126083130.GA17725@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 26, 2020 at 02:01:30PM +0530, Saurav Girepunje wrote: > Fix the warning reported by cocci check. > > Changes: > > In queue_work fw dereference before it actually get assigned. > move queue_work before gb_bootrom_set_timeout. Nope. As I said yesterday, you need to verify the output of any static checkers you use. The code may be unnecessarily subtle, but there's no way fw can be dereferenced before being initialised currently. > -queue_work: > /* Refresh timeout */ > if (!ret && (offset + size == fw->size)) Specifically, the second operand is never evaluated if ret is non-zero. > next_request = NEXT_REQ_READY_TO_BOOT; > - else > - next_request = NEXT_REQ_GET_FIRMWARE; > > +queue_work: > gb_bootrom_set_timeout(bootrom, next_request, NEXT_REQ_TIMEOUT_MS); > > return ret; Johan