From patchwork Tue Jun 13 18:34:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Raphael Tiovalen X-Patchwork-Id: 1794625 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=WBw2Qqjt; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qgcfz4lcFz20XW for ; Wed, 14 Jun 2023 04:35:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4AC5182330; Tue, 13 Jun 2023 18:35:05 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 4AC5182330 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=WBw2Qqjt X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eI-6M0ECFSQa; Tue, 13 Jun 2023 18:35:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 734C982893; Tue, 13 Jun 2023 18:35:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 734C982893 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4C06BC009A; Tue, 13 Jun 2023 18:34:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id D7BC4C008C for ; Tue, 13 Jun 2023 18:34:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A497182089 for ; Tue, 13 Jun 2023 18:34:57 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A497182089 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eH7Mea5g8CBt for ; Tue, 13 Jun 2023 18:34:56 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B520C82269 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by smtp1.osuosl.org (Postfix) with ESMTPS id B520C82269 for ; Tue, 13 Jun 2023 18:34:56 +0000 (UTC) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1b3a6469623so21475875ad.3 for ; Tue, 13 Jun 2023 11:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686681295; x=1689273295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=moW7cNpRfuaXoKqagJrAbwWUPxBijx+TwIy6Fw+x5n8=; b=WBw2QqjtYOUjSCGHME5MLY3KYDj3xCK5RiBIrNqzhZALihf+LG4QJdEt6W9Bqr3GL4 z1o8maBiN8+7LjFxEthkOySx1XzVUYyeGIST4x93WqdF5TJXzWIjVv/68VNz4K5wnQmk IR7A5SLWp6GoKZWJYRTT6TfQB+teMQjvyOoxQUJhm816KZnd5bmKvA/s+BTa4mwNC2dz HKR2dgweqCMxWAZ0UtoMhFYgqcJqdiwulboGI3q8hgyhQWmPwxaIkC+Hmyl5HdLfiH4D yS0jg+xtu8mqJvwy3ofGmN/8LPpu8sotqXyZ54hOjEnZP26pbS21ovPFr9wW3bvMIsgH wEFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686681295; x=1689273295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=moW7cNpRfuaXoKqagJrAbwWUPxBijx+TwIy6Fw+x5n8=; b=hFSUOCM01f4pYPI5f+C9W0XU5kbqerm48sWeT9cyVNIwNOtgKBy9Z0u3WEAaTvbbPY /UIdKQ3fyh1Tiy7yKjLuhYJoriKzmRKF8JLYFauj7u4oA4tHU74L/76yzGvBM3NZzO03 9bUzKgEA+MAgjiaxY3zH8UFaQ72oLEzZQn+ZQCa6vuNqBBfHYb7oESjLSlkhB0m0gnXP L8xjgfg+NZnUpqxJ/+tcBDE+ZyQbBi/J0ZFlgCg1lnQlw9DVmxKaAEIgnXJnMMH2jj6+ Qlk9nLXLQzZcR4qp8dwqMrDMK0SHBV6QgvYpidbZBJI+Eo8CJD4JsevSL9SmaDepOxfw tyTA== X-Gm-Message-State: AC+VfDw8rXkcjDS3oTF9ehsIu+c/WUg9vnfbKHGCvsEktofz7hHioMDA tnX6qVvR5If1AzwK5W/3koGR7FHw6ZHUpQ== X-Google-Smtp-Source: ACHHUZ5zEF8mwbapxH6JyoxhaI5C1dpmFC8u5gapd0bDD0RNfTBhR0YomM6B9hD8ltvK3bJkJPDWKQ== X-Received: by 2002:a17:903:124d:b0:1b1:b2fa:1903 with SMTP id u13-20020a170903124d00b001b1b2fa1903mr10964571plh.41.1686681295629; Tue, 13 Jun 2023 11:34:55 -0700 (PDT) Received: from JRT-PC.lan ([103.252.200.22]) by smtp.gmail.com with ESMTPSA id u3-20020a170902e80300b001b04aee1f99sm10531125plg.228.2023.06.13.11.34.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 11:34:55 -0700 (PDT) From: James Raphael Tiovalen To: dev@openvswitch.org Date: Wed, 14 Jun 2023 02:34:40 +0800 Message-Id: <20230613183443.31540-6-jamestiotio@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230613183443.31540-1-jamestiotio@gmail.com> References: <20230613183443.31540-1-jamestiotio@gmail.com> MIME-Version: 1.0 Cc: Simon Horman , James Raphael Tiovalen Subject: [ovs-dev] [PATCH v12 5/8] file, monitor: Add null pointer assertions for old and new ovsdb_rows X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This commit adds non-null pointer assertions in some code that performs some decisions based on old and new input ovsdb_rows. Signed-off-by: James Raphael Tiovalen Reviewed-by: Simon Horman Acked-by: Eelco Chaudron --- ovsdb/file.c | 2 ++ ovsdb/monitor.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ovsdb/file.c b/ovsdb/file.c index 2d887e53e..b1d386e76 100644 --- a/ovsdb/file.c +++ b/ovsdb/file.c @@ -522,7 +522,9 @@ ovsdb_file_txn_add_row(struct ovsdb_file_txn *ftxn, } if (row) { + ovs_assert(new || old); struct ovsdb_table *table = new ? new->table : old->table; + ovs_assert(table); char uuid[UUID_LEN + 1]; if (table != ftxn->table) { diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c index 4afaa89f4..c32af7b02 100644 --- a/ovsdb/monitor.c +++ b/ovsdb/monitor.c @@ -1372,8 +1372,10 @@ ovsdb_monitor_changes_update(const struct ovsdb_row *old, const struct ovsdb_monitor_table *mt, struct ovsdb_monitor_change_set_for_table *mcst) { + ovs_assert(new || old); const struct uuid *uuid = ovsdb_row_get_uuid(new ? new : old); - struct ovsdb_monitor_row *change; + ovs_assert(uuid); + struct ovsdb_monitor_row *change = NULL; change = ovsdb_monitor_changes_row_find(mcst, uuid); if (!change) {