Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1522125rwb; Fri, 13 Jan 2023 13:32:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXtA/sJkrJMCbdPCKx0KMWWUMQoCcbEfmcqMIx7zjhmH2qyan1uUv9QOyhg3P5seYgcdFWCM X-Received: by 2002:a05:6a20:d494:b0:b6:4b4a:bfc5 with SMTP id im20-20020a056a20d49400b000b64b4abfc5mr12535167pzb.22.1673645566137; Fri, 13 Jan 2023 13:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673645566; cv=none; d=google.com; s=arc-20160816; b=kGkDTHeAfOxQJL4euBjwg4ElEloV/uPydlTri4/ZJvFyC5jgW7LARglksQXEkapbBf uy0lONS6MNouX5f9jZsH/+iBocY7z7Cpp1u+bQrQT+JlMiC/ra6C/kdeuZbjzdIX52Fa XeXcIsUeZ72NFBcFhUUx7I/DwqsPchrfBy4TPj+OStbQX/fRtgcjqjO+eZqd4xH2Eree +Pj07nJ8uBFAh7ykmpzNjOjVrm9bbQvqJ6wN62Jys40uvc+CXUfp0tBc1Ime3vq2OjaD 99NbE4pBm5OMMncq16Js42y0Y9/9ok67vvcpxh7c04aj1NhOs7J6DshZeSsUHQzsT1+z zYZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=PKHl4FcHTYGz1OAoZvVK8y2v6I21QYioOCPJWYz+G9E=; b=NbslnMBUD4gO0HH8uSOKKo0S32zjoBGjhh0Sj/KeHy7YA7rCvo/HwymI/cbrME6qVQ DWxwF9hABmuQZ3aKyUkkGFskh8pye870SC2YVNHAis3EfqEjEZpghVVPkzf2iVoemZtc jYj/sqCXl94kCm6GmrIsGACk4tWu8pIs1x7KA9wzM0OfvbYwdd56AGlowmANg6IxmrwL lbGSGPlMxHthezjer8cXAcEIACTCO+xrXi29hbwY62xxDlGWcfz0esSbQbcU0MmMkJ4s /wXQt29KGGvllpX42F9LUdOkmT0qpIRGjvIhpgfhwsltpPT/Am33hBdGrCv0ljMPzioU Bzcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lns9ojO3; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a63d207000000b00462a6f64703si22480480pgg.376.2023.01.13.13.31.47; Fri, 13 Jan 2023 13:32:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lns9ojO3; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbjAMVTB (ORCPT + 99 others); Fri, 13 Jan 2023 16:19:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231252AbjAMVST (ORCPT ); Fri, 13 Jan 2023 16:18:19 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA8B9892E5 for ; Fri, 13 Jan 2023 13:16:41 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id o13so20124722pjg.2 for ; Fri, 13 Jan 2023 13:16:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=PKHl4FcHTYGz1OAoZvVK8y2v6I21QYioOCPJWYz+G9E=; b=lns9ojO3XcHud2zz1j/fmPVww9eZbBHqqtHwMMz5m59w/zUqPbk2Hk0a/YLtZV0W5y oIJOkmBAwBfnGl7JShELDrGhFPNYaDaIc9uXfj/T0T6MATdvx0xtRUZc/WqEKPhBUsMy K02LFeAdnTL8kJluflgyMAdBwLuy6EWq/aJEx/RuDvEHH1brWHDle+EPG64BTm/AVAFC XrZhmVGtEaw7IysfxL6nx4+EpwP2T1O3qzyI4411yhcfffL+Zpo0czNadfdYW5nGG5wp 14lop5TO/fBKhwfStspbg/GHf/rXOxVLhfg1AwdzY8Jji5bRpOTbgNcUznGlCJRRfFWR knJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PKHl4FcHTYGz1OAoZvVK8y2v6I21QYioOCPJWYz+G9E=; b=PXDh7TMznKzRzgorVOwwsea/e8lB4i2P2GldB/0LzGk0Vjy8DaGXMHGqLoDJO/usbZ 4p+f6+/86skb3KOKMAaV1GnnX1U5ShI/KhGI78uHCfsVwU9QoZZ89a/dEU1bBygDyTrH JWw0g3OIL113xk/Ce6Lp0CdYhQGxCpxBFopzv/+pz+RnThLEUhizCdunEs2THncQRJPb wY/wyyAboTUGHxcQE3MckuhH6ofrsECPRoeAOerLip1X6RmP41idDrxNlTHYmtTPG0+2 VzAEPzppFpHmTP8f7DBtKa/uW4us1+O5j9TE6TSWanbpqzuKDsSFGu1hu7bsBgYRP9jy pHNQ== X-Gm-Message-State: AFqh2kpTvmO2A2Sbh95TCBxMaU4sPKQjOxyvdGLK51AI8vh+E9bm0Wdn /nQbIGva+Sfq9ykZlRE8dq+NqijRMIY= X-Received: by 2002:a17:902:bd98:b0:188:8cfc:6ba7 with SMTP id q24-20020a170902bd9800b001888cfc6ba7mr82612191pls.68.1673644600896; Fri, 13 Jan 2023 13:16:40 -0800 (PST) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id v7-20020a1709028d8700b00192902287d1sm14475194plo.288.2023.01.13.13.16.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 13:16:39 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] shared/bap: Fix scan-build warning Date: Fri, 13 Jan 2023 13:16:38 -0800 Message-Id: <20230113211638.303409-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This fixes the following warning: src/shared/bap.c:2268:26: warning: Access to field 'iov_len' results in a dereference of a null pointer (loaded from variable 'cont') return iov_append(data, cont->iov_len, cont->iov_base); ^~~~~~~~~~~~~ --- src/shared/bap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/shared/bap.c b/src/shared/bap.c index 0cafb75e69d0..88697988e991 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2261,6 +2261,12 @@ static void *ltv_merge(struct iovec *data, struct iovec *cont) { uint8_t delimiter = 0; + if (!data) + return NULL; + + if (!cont || !cont->iov_len || !cont->iov_base) + return data->iov_base; + iov_append(data, sizeof(delimiter), &delimiter); return iov_append(data, cont->iov_len, cont->iov_base); -- 2.37.3