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 4E8E845BC5; Thu, 24 Oct 2024 17:19:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 21EC140265; Thu, 24 Oct 2024 17:19:54 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id F1C644025F for ; Thu, 24 Oct 2024 17:19:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729783191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cYUDC2qeolSbGy5uZ+ALY+0PiMyvtTj8DEYaXy2NIYs=; b=VldsYKVBG0dWB6NqZQ9amJKc5vgcu/jYq4AcvgwOPzmJ1FFzQffRJGItMciO9WzHWFq4xZ eBE8A2QtFCjs4sgN/1sa8GW4bpXy8K2PZmNopYoH+cx9WOq0XaCzPtuH0wHm3L6DsmuW1K H/5DGUy0NInOh+SsyzTbftPUvCvrZk8= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-607-mBGOzn4HNlKaj95iupaV0w-1; Thu, 24 Oct 2024 11:19:50 -0400 X-MC-Unique: mBGOzn4HNlKaj95iupaV0w-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 256371936CFB for ; Thu, 24 Oct 2024 15:19:31 +0000 (UTC) Received: from ringo.home (unknown [10.39.208.32]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EA6D1195607C; Thu, 24 Oct 2024 15:19:23 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org Subject: [PATCH dpdk 0/2] IPv6: Fix coverity issues Date: Thu, 24 Oct 2024 17:19:20 +0200 Message-ID: <20241024151919.400878-4-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 Hi all, Here are fixes for three coverity issues: /lib/net/rte_ip6.h: 91 in rte_ipv6_addr_mask() *** CID 446754: Memory - illegal accesses (OVERRUN) 85 { 86 if (depth < RTE_IPV6_MAX_DEPTH) { 87 uint8_t d = depth / 8; 88 uint8_t mask = ~(UINT8_MAX >> (depth % 8)); 89 ip->a[d] &= mask; 90 d++; >>> CID 446754: Memory - illegal accesses (OVERRUN) >>> Overrunning array of 16 bytes at byte offset 16 by dereferencing pointer >>> "&ip->a[d]". 91 memset(&ip->a[d], 0, sizeof(*ip) - d); 92 } 93 } /lib/net/rte_ip6.h: 114 in rte_ipv6_addr_eq_prefix() *** CID 446756: Memory - illegal accesses (INTEGER_OVERFLOW) 108 rte_ipv6_addr_eq_prefix(const struct rte_ipv6_addr *a, const struct rte_ipv6_addr *b, uint8_t depth) 109 { 110 if (depth < RTE_IPV6_MAX_DEPTH) { 111 uint8_t d = depth / 8; 112 uint8_t mask = ~(UINT8_MAX >> (depth % 8)); 113 >>> CID 446756: Memory - illegal accesses (INTEGER_OVERFLOW) >>> "d", which might have overflowed, is used in a pointer index in "a->a[d]". 114 if ((a->a[d] ^ b->a[d]) & mask) 115 return false; 116 117 return memcmp(a, b, d) == 0; 118 } 119 return rte_ipv6_addr_eq(a, b); /lib/net/rte_ip6.h: 89 in rte_ipv6_addr_mask() *** CID 446758: Memory - corruptions (INTEGER_OVERFLOW) 83 static inline void 84 rte_ipv6_addr_mask(struct rte_ipv6_addr *ip, uint8_t depth) 85 { 86 if (depth < RTE_IPV6_MAX_DEPTH) { 87 uint8_t d = depth / 8; 88 uint8_t mask = ~(UINT8_MAX >> (depth % 8)); >>> CID 446758: Memory - corruptions (INTEGER_OVERFLOW) >>> "d", which might have overflowed, is used in a pointer index in "ip->a[d]". 89 ip->a[d] &= mask; 90 d++; 91 memset(&ip->a[d], 0, sizeof(*ip) - d); 92 } 93 } Cheers. Robin Jarry (2): net/ipv6: fix overflowed array index reads net/ipv6: fix out-of-bounds read lib/net/rte_ip6.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.47.0