Message ID | 20180804203555.23887-4-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show
Return-Path: <linux-sparse-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68F4C13AC for <patchwork-linux-sparse@patchwork.kernel.org>; Sat, 4 Aug 2018 20:36:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53E3C29AA5 for <patchwork-linux-sparse@patchwork.kernel.org>; Sat, 4 Aug 2018 20:36:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48C4229AAE; Sat, 4 Aug 2018 20:36:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFB5729AA5 for <patchwork-linux-sparse@patchwork.kernel.org>; Sat, 4 Aug 2018 20:36:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729600AbeHDWhz (ORCPT <rfc822;patchwork-linux-sparse@patchwork.kernel.org>); Sat, 4 Aug 2018 18:37:55 -0400 Received: from mail-ed1-f49.google.com ([209.85.208.49]:35051 "EHLO mail-ed1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728945AbeHDWhz (ORCPT <rfc822;linux-sparse@vger.kernel.org>); Sat, 4 Aug 2018 18:37:55 -0400 Received: by mail-ed1-f49.google.com with SMTP id e6-v6so3365497edr.2 for <linux-sparse@vger.kernel.org>; Sat, 04 Aug 2018 13:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hifnqZVoc7ZRYvPq0/b5ZpiMK69iCfmuX5n2wve9obg=; b=A+Eah7RKgUwzczP2m3QHdQDZye+FXmCxk8uiwkw7Xg4jjWTHh6MoSnXXGQGJvmJs1d TWhw5DLeKZFGxxzppjlRYZYMOTMXLxtMTD1666Uu4Tbtt3WJspao5pypXsLs9NTk6jwb NQxsETfUSUIKk3Ax8m+98RjbDICed74GfsMuA5OzaLGzNDuqnaXZjVfiBLNyG20fL60p /J7oAMZBAwB37mhAqgg7rTEO+6MmYdV5KdrjJYB8ISd178yJnTGZb5uAuiG8l0CNCfRd pItmjVBZSxDZtKGxmjmrxuQHu8zWkOhwhCwsP7bM4iVAhC3BoRtO3OzUhQ5i1voyVW0G oaqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hifnqZVoc7ZRYvPq0/b5ZpiMK69iCfmuX5n2wve9obg=; b=YGxyJd+olkQsAPkzhsNtP4HL3iZEkJZhQEEpHywUHmbR1Zh3ws0IZ1GhlB8CdyIoYG 0FLRcz+/ooLfBg2exFfMYUvohf+togwAs+kyM5V4kNxLhM4+lfJMfFYBcPetOhmp2Wh7 QGdiG2ho8o8juk+4aPgy4pqXRMbqeUhj/3Tt+ODz2LnRnJiO4H18CbfluGcoe3njspLr Gy5pn9AnTa4pc/xFK267jzVf2MHBZjQ4y8qHbKKeIAhBEOvSW/Hw2aGYcESBqOffjUVc jCu0ZpHMRCRx7uLSniu4Tjf0//3uPZ2VukzScDQeBN+2wsNbKNgL7ETkwgmshfkCtfTU GjBQ== X-Gm-Message-State: AOUpUlFuR9V9OPD0a42POyh6inzmBF1E+Mn/Ee/OgTwCMi7UkNK8ZRc2 LTOoIcbYD3UrmnFlbc2hDy4nA2QO X-Google-Smtp-Source: AAOMgpfWxXCMT9v0o3i+aDQ1aRIJFscKp5mcu3FV0lxAqRvCPyHYk6l6UnL++Iqjva8wbol5+lqc5A== X-Received: by 2002:aa7:c641:: with SMTP id z1-v6mr12522203edr.9.1533414961661; Sat, 04 Aug 2018 13:36:01 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:401a:e800:80cc:62a6:803b:37ad]) by smtp.gmail.com with ESMTPSA id f16-v6sm3395462edq.36.2018.08.04.13.36.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Aug 2018 13:36:01 -0700 (PDT) From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Subject: [PATCH 03/13] protect add_convert_to_bool() against bad types / invalid expressions Date: Sat, 4 Aug 2018 22:35:45 +0200 Message-Id: <20180804203555.23887-4-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180804203555.23887-1-luc.vanoostenryck@gmail.com> References: <20180804203555.23887-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: <linux-sparse.vger.kernel.org> X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
fix linearize_logical() & simplification
|
expand
|
diff --git a/linearize.c b/linearize.c index 016b853b9..7aa7fd4c3 100644 --- a/linearize.c +++ b/linearize.c @@ -1376,6 +1376,8 @@ static inline pseudo_t add_convert_to_bool(struct entrypoint *ep, pseudo_t src, pseudo_t zero; int op; + if (!type || src == VOID) + return VOID; if (is_bool_type(type)) return src; if (is_float_type(type)) {
It's not possible to do a boolean conversion of an expression if this expression is invalid / has not type / is VOID. Fix this by returning VOID in these situations. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- linearize.c | 2 ++ 1 file changed, 2 insertions(+)