Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1825780pxj; Sun, 16 May 2021 05:32:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwmLXd8EmibW7tpZyqzDLV0wQq+JJMkM5QsKzYorOGV3o/iKC5A7nWUFhVv2j0pRJArJll X-Received: by 2002:a17:906:144d:: with SMTP id q13mr59540855ejc.458.1621168341823; Sun, 16 May 2021 05:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621168341; cv=none; d=google.com; s=arc-20160816; b=FjbV9IFB7+AHV5RVy8OsQLEpotI/Y3qYqjJyNtWqFWEx22vO4bamP1Dfttco7OMamb /lvW2Wwtd8pEKt3c79xnGaF2/eoyYU1I7gJEJJYWT+nDSZKPRnP9BbixyARhHyw5EXc5 7ISzn3rSfIlNb8usIcX46xWGSd7pcaApMSRyLS2zqz74pzRyalRdOgHzuYQr6axUbdIM gi9rh03DWyCO7wL482/dzCzH0afRY4CXCfLNzqhOA752FqEPjHsnudiePp1MGeZXplw+ QuX+TQkfNydFbbp60z98zVVadgbIH+33dabszzazWpft3B7FoWCVDQpV0g7vaS7cXvhJ niXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JcqP0OeNjgBhhon0AQdW6vw7fHTq3bBpv6lDo9wrXmQ=; b=Oa+BR6pvcEF+LkpZjyaz/dODwZbNq2Xh2qaq64gaXYLYDgICIplJbnKr8+k3i48va/ YMzsTsE1ofR41c+HlefiPeZfjjG6xThk/ZOcbcKywbqBd4rRG5sqW5Z8QYDNAgtLg+Yq zu/n7JgvqEoGMClEwIuhCiYv0t0sF0ec+4AyTf9YbAEMAA0rXlNhmPpJAtoHgyM4qdCn oU6OZFS30avu0YmVH2qfU71HX5ndOO3lbMxwemnxRzygCgAm6Vj2rCWDS8I5lNnPdSw4 jLlfxGMNgwdx0t7clL9mCEmBell/iarRU3BhcHjX4ulM8UT+suSqCNRfICkzE15Kpmu1 Wkjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Ye6npR94; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay17si12745910ejb.736.2021.05.16.05.31.44; Sun, 16 May 2021 05:32:21 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=Ye6npR94; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234923AbhEOUiI (ORCPT + 99 others); Sat, 15 May 2021 16:38:08 -0400 Received: from mail.skyhub.de ([5.9.137.197]:37244 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233286AbhEOUiD (ORCPT ); Sat, 15 May 2021 16:38:03 -0400 Received: from zn.tnic (p200300ec2f1e9400519c4c3da1ce0d62.dip0.t-ipconnect.de [IPv6:2003:ec:2f1e:9400:519c:4c3d:a1ce:d62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id C665B1EC0409; Sat, 15 May 2021 22:36:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1621111008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=JcqP0OeNjgBhhon0AQdW6vw7fHTq3bBpv6lDo9wrXmQ=; b=Ye6npR94RCuW1sMBE4SLhIq0ESd6OlN6Yst2vn+X2zpMokVgwBCg7OS/LFJmJjZ0BIxQl6 jm7mXCcY2FVrVSkGhpKrUC0WuZhffXivoIy+GUm2yWL9N55qaBFkFSe5VSQyDshfugPYcx qEJ5xETINNQvfx0LuqU3CERrTOdnzwU= Date: Sat, 15 May 2021 22:36:45 +0200 From: Borislav Petkov To: Khaled ROMDHANI Cc: peterz@infradead.org, jpoimboe@redhat.com, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH-next] x86/kernel: Fix unchecked return value Message-ID: References: <20210515202212.24836-1-khaledromdhani216@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210515202212.24836-1-khaledromdhani216@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 15, 2021 at 09:22:12PM +0100, Khaled ROMDHANI wrote: > From the coverity scan analysis, the return value from > insn_decode_kernel is not checked. It is a macro constructed > from the insn_decode function which may fail and return > negative integer. Fix this by explicitly checking the > return value. > > Addresses-Coverity: ("Unchecked return value") > Signed-off-by: Khaled ROMDHANI > --- > arch/x86/kernel/jump_label.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c > index a762dc1c615e..bf0ea003b6e7 100644 > --- a/arch/x86/kernel/jump_label.c > +++ b/arch/x86/kernel/jump_label.c > @@ -23,7 +23,7 @@ int arch_jump_entry_size(struct jump_entry *entry) > { > struct insn insn = {}; > > - insn_decode_kernel(&insn, (void *)jump_entry_code(entry)); > + WARN_ON(insn_decode_kernel(&insn, (void *)jump_entry_code(entry))); I don't think coverity is smart enough to notice... > BUG_ON(insn.length != 2 && insn.length != 5); ^^^^^^^^^^^^^ ... this line. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette