Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp884487ybb; Wed, 1 Apr 2020 11:25:01 -0700 (PDT) X-Google-Smtp-Source: APiQypLrgSvtI5pgA2sj4SaJdof/As0EQzA/1yuWSIjrSPqEgnGsJhPfBLRHDmaYtKzsmQ6h7gk3 X-Received: by 2002:aca:706:: with SMTP id 6mr3680834oih.115.1585765501407; Wed, 01 Apr 2020 11:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585765501; cv=none; d=google.com; s=arc-20160816; b=SmwGqHXgfRxsrsf8Spt9LH8UY2VQz20nkUEC3cvzlGVNvwtSGlaZzVWrSbeVqWaOcV Zxz3jwlxKjZBNoOsBZpHl9LpQlxSCQ4f/lVZM/9gD749b63yq/r8Ewo4uCnQlbQA0slQ n+AgKQyjeLu5/4skpr4XEcGVn02bjefgMcdpHHnkbseI6FKY8n4uCNFMhfbWXBb8HymW GdVU4Pu0BoBO5XZ7yGggeOnQrhiZwJIKfLkTLWSXxyjofUMnl5siWdQkdv0DbJ6f9AV/ nyx53tW+WsQNLHgidab1+aEnbTLvkB7yaTpgjTOtttuNyYuuyLkw6KfV5HZH6ZgthqzO WOGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8szS2/P4Z3/SR98iwz6z1Q9e8O85YRT99ZqA66Wzkvg=; b=X5MznQu29sKiORXzQPvmK+NG8tzr1+nAbok57fXxcULGrlCNGHpihvcPdwJ9jXylB3 0K/LRShvcgl1krp4DIOJmqQUQn5VJ2juYDmWzCxaxI4pLu5uL8UOyPry87rcpYYWmYvQ hxQntO5m9kF0BG3oWUcD05O8T1s3EBIgHHXlH9K/3bfbsVBI033S5fxRXPqkKsTihf+h 2yZWSiVIjDpv6dHQXjhhu8ngFsTzgeqj4FwpbFXKoi1JaWmqS1j1xWEjeYQ4vXZlfC7L zrYF8TScUsL1m7UqW8bR19YcGM8u4RGh76joMcrqj0HRE6EwK7ybiV8l7lLC/tN1DIsY 1wgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UX/9Uu0B"; 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=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 a18si1191224otq.286.2020.04.01.11.24.48; Wed, 01 Apr 2020 11:25:01 -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=@redhat.com header.s=mimecast20190719 header.b="UX/9Uu0B"; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732917AbgDASXt (ORCPT + 99 others); Wed, 1 Apr 2020 14:23:49 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:47263 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732910AbgDASXs (ORCPT ); Wed, 1 Apr 2020 14:23:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585765427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8szS2/P4Z3/SR98iwz6z1Q9e8O85YRT99ZqA66Wzkvg=; b=UX/9Uu0B1Wb3seIp4nFDjdqxpkOaOkGb5Kbo33ipDceJP/Bsn3j3uYQupswS+5ggahC9Mj 9QcXFyWEwk+WeUxriOCokQ/k3dv+awVXr40FN96UijteFmBaBmlLI8Ad4y1ZewBoo3TSLM GPjyad6pW4el6KJJCYowd4Pg5piccuI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-SR-3u1lnPYadle6HyGLizQ-1; Wed, 01 Apr 2020 14:23:43 -0400 X-MC-Unique: SR-3u1lnPYadle6HyGLizQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 691CD18A8C82; Wed, 1 Apr 2020 18:23:41 +0000 (UTC) Received: from treble.redhat.com (ovpn-118-135.phx2.redhat.com [10.3.118.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id BADDE60BEC; Wed, 1 Apr 2020 18:23:40 +0000 (UTC) From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Miroslav Benes , Julien Thierry , "Gustavo A . R . Silva" Subject: [PATCH 5/5] objtool: Make BP scratch register warning more robust Date: Wed, 1 Apr 2020 13:23:29 -0500 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If func is NULL, a seg fault can result. This is a theoretical issue which was found by Coverity. Fixes: c705cecc8431 ("objtool: Track original function across branches") Addresses-Coverity-ID: 1492002 ("Dereference after null check") Reported-by: Gustavo A. R. Silva Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index c681a26c25ac..93fa7be67e9f 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2023,8 +2023,8 @@ static int validate_return(struct symbol *func, str= uct instruction *insn, struct } =20 if (state->bp_scratch) { - WARN("%s uses BP as a scratch register", - func->name); + WARN_FUNC("BP used as a scratch register", + insn->sec, insn->offset); return 1; } =20 --=20 2.21.1