From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6DEB45B13; Fri, 11 Oct 2024 16:30:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 780514028B; Fri, 11 Oct 2024 16:30:50 +0200 (CEST) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mails.dpdk.org (Postfix) with ESMTP id 168A94025F for ; Fri, 11 Oct 2024 16:30:49 +0200 (CEST) Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-7ea53eaf604so565140a12.0 for ; Fri, 11 Oct 2024 07:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728657048; x=1729261848; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=+6kJQh3uK6zQM3OWssJFOOg1O5dZne2sdyLhB9y1BNU=; b=1FGF0Daz4ZD+z8iwJqUOqqwenx5DYULVmLzjJuyXTSAqTOLdLXFRltgY+6Q/RA30Se v/juAQ1TxX5fni8DbE0bC4ZxiQNExsVL8aZB8nj85kKHHl81iJvec40OVepNbdXOynzS Dtd3teynuifFOgEEkopAGdix8r1raZueqsDi64mdruLUTCHUBeaFFP71crpaQA/XfG5r EG32jKf9H7h7KWpuwZk9EblERMtcKmHALLp42pp5/wxUkISqBl1bVPCjbIJc6fAMNneA FzFIkcMXfETPr0wnqj/WqolLzKoT5lXrLZQyKJskx4a6gbbYnveDLHlfjg3sKtMpTGtG qmxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728657048; x=1729261848; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+6kJQh3uK6zQM3OWssJFOOg1O5dZne2sdyLhB9y1BNU=; b=Byywu+nghNyZaVmR1dXB16PpS7Xeqo/7ecyVTmnNoIx99YrUhZKwAlQfkQ3ZGUqUQ5 in/LvG8hZ5uQXUw1xcbIuIJUEY6KzzB2LerHwVdWIgY4SA3tUem6wLp3dkJkUteeUZaj /EAMAufwnxOQ/B9BINLfB1Rho2RYFeKS2yZz12hEBuZ++Yf3SLUIRH1Bbu2cvNHhbjEq /dwhwbqf4lJL628ApbBPbW6r/dKCKihofvF4ArFXioQKJVU0XRUMALhlxpUY9FHcwNvc 0DJYdeu/3+RpFqEtPsXAy+zMfYqdmWuB2Y4s52aHh8ubvb9gXSVBUaArQU6giIVIKwlc uBhw== X-Gm-Message-State: AOJu0Yz8RWNnB33tHAtaeNQSqz6ITagjlZSMF8kGl7yVmzzvA710c0kL Dcue9o616CCi4ePXneCq3rnQWl1gzF/UiDD5UEvXQ47hN0uF653f09VfCNQ8Ugc= X-Google-Smtp-Source: AGHT+IGidtWCPGigZDtbcubZV3L6e8OJ5YpxZhKAAeth798KKm1vubxWzLIRnnkT0W/TPWXUlZuQYg== X-Received: by 2002:a05:6a21:4a4c:b0:1d8:a6bb:275f with SMTP id adf61e73a8af0-1d8bcfb63c5mr3666188637.45.1728657048049; Fri, 11 Oct 2024 07:30:48 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ea448f9b71sm2382672a12.36.2024.10.11.07.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 07:30:47 -0700 (PDT) Date: Fri, 11 Oct 2024 07:30:46 -0700 From: Stephen Hemminger To: Tianli Lai Cc: dev@dpdk.org, Reshma Pattan Subject: Re: [PATCH] app/dumpcap:fix coredump problem because pcap_dump 3th argument is null Message-ID: <20241011073046.7b728867@hermes.local> In-Reply-To: <20240301104129.3725-1-laitianli@tom.com> References: <20240301104129.3725-1-laitianli@tom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Fri, 1 Mar 2024 18:41:29 +0800 Tianli Lai wrote: > if rte_pktmbuf_read() return NULL, pcap_dump() would coredump. > > Signed-off-by: Tianli Lai To safely handle jumbo packets, the code here should increase the size of temp_data, then the RTE_MIN() is not needed either. See drivers/net/pcap/pcap_ethdev.c for (i = 0; i < nb_pkts; i++) { mbuf = bufs[i]; len = caplen = rte_pktmbuf_pkt_len(mbuf); if (unlikely(!rte_pktmbuf_is_contiguous(mbuf) && len > sizeof(temp_data))) { caplen = sizeof(temp_data); } calculate_timestamp(&header.ts); header.len = len; header.caplen = caplen; /* rte_pktmbuf_read() returns a pointer to the data directly * in the mbuf (when the mbuf is contiguous) or, otherwise, * a pointer to temp_data after copying into it. */ pcap_dump((u_char *)dumper, &header, rte_pktmbuf_read(mbuf, 0, caplen, temp_data));