Skip to content

Conversation

@hnattamaisub
Copy link

This commit addresses null pointer dereference in zebra folder.

Description:
Handled null check accordingly.

This commit addresses null pointer dereference in zebra/zebra_rib.c

CID 18943 : Dereference null return value (NULL_RETURNS)
dereference: Dereferencing nhg, which is known to be NULL.

Description:
Handled null check accordingly.

Signed-off-by: Harini Subramanian <[email protected]>
@frrbot frrbot bot added the zebra label Oct 30, 2025
@hnattamaisub hnattamaisub changed the title zebra: Coverity issue (Null pointer derefence -med severity) zebra: Coverity issue (Null pointer dereference -med severity) Oct 31, 2025
int result;
struct route_node *rn = rib_find_rn_from_ctx(ctx);

if (!rn) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the right thing to do here is to extract the prefix info from the ctx?

Copy link
Author

@hnattamaisub hnattamaisub Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from your comment , i tired to understand, i should take prefix itself, which may lead to below lines of code changes, is the below understanding correct ? can i proceed the changes like below, or something else u meant?
int zsend_route_notify_owner_ctx(const struct zebra_dplane_ctx *ctx,
enum zapi_route_notify_owner note)
{

  const struct prefix *dest_p, *src_p;

   /* Extract prefix information directly from context */
  **dest_p = dplane_ctx_get_dest(ctx);
   src_p = dplane_ctx_get_src(ctx);  

  return route_notify_internal(dest_p, src_p, dplane_ctx_get_type(ctx),**
                               dplane_ctx_get_instance(ctx),
                                dplane_ctx_get_vrf(ctx),
                                dplane_ctx_get_table(ctx), note,
                              dplane_ctx_get_afi(ctx),
                               dplane_ctx_get_safi(ctx));

}

in that api **route_notify_internal(const struct prefix dest_p,
const struct prefix src_p,

int type, uint16_t instance,
vrf_id_t vrf_id, uint32_t table_id,
enum zapi_route_notify_owner note,
afi_t afi, safi_t safi)
{

    stream_put(s, &note, sizeof(note));
   **stream_putc(s, dest_p->family);
   blen = prefix_blen(dest_p);
   stream_putc(s, dest_p->prefixlen);
   stream_put(s, &dest_p->u.prefix, blen);**
    if (!src_p) {
          **src_dummy.family = dest_p->family;**
            src_p = &src_dummy;
    }

@hnattamaisub hnattamaisub force-pushed the cov_zeb branch 3 times, most recently from 5a35e0a to 138387e Compare October 31, 2025 14:35
@mjstapp
Copy link
Contributor

mjstapp commented Oct 31, 2025

Hey, don't mean to be blunt, but ... why did you close this, without any explanation? I spent time reviewing it - was that just wasted time? should reviewers just ignore future PRs from you?

@hnattamaisub hnattamaisub reopened this Oct 31, 2025
@hnattamaisub
Copy link
Author

ci:rerun

@hnattamaisub
Copy link
Author

Hey, don't mean to be blunt, but ... why did you close this, without any explanation? I spent time reviewing it - was that just wasted time? should reviewers just ignore future PRs from you?

sorry , i am new to community, my intention was not to ignore your comments, i thought of separating this PR into two PR's for easier review/approval . I got to know the procedure now, reopened this PR again , will ensure not to make this mistake again. Thanks

Harini Subramanian added 6 commits November 2, 2025 23:05
This commit addresses null pointer dereference in zebra/zebra_evpn_neigh.c

CID 72714: Dereference null return value (NULL_RETURNS)
dereference: Dereferencing zvrf, which is known to be NULL.

Description:
Handled null check accordingly.

Signed-off-by: Harini Subramanian <[email protected]>
This commit addresses null pointer dereference in zebra/zebra_evpn.c

CID 72706: Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking macaddr suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.

Description:
Handled null check accordingly.

Signed-off-by: Harini Subramanian <[email protected]>
This commit addresses null pointer dereference in zebra/zapi_msg.c

CID 71721: Dereference null return value (NULL_RETURNS)
dereference: Dereferencing a pointer that might be NULL rn when calling route_notify_internal.

Description:
Handled null check accordingly.

Signed-off-by: Harini Subramanian <[email protected]>
This commit addresses null pointer dereference in zebra/zebra_router.c

CID 109575: Dereference null return value (NULL_RETURNS)
dereference: Dereferencing zrt, which is known to be NULL.

Description:
Handled null check accordingly.

Signed-off-by: Harini Subramanian <[email protected]>
This commit addresses null pointer dereference in zebra/zebra_nhg.c

CID 90819: Dereference null return value (NULL_RETURNS)
dereference: Dereferencing a pointer that might be NULL new when calling zebra_nhg_increment_ref.

Description:
Handled null check accordingly.

Signed-off-by: Harini Subramanian <[email protected]>
This commit addresses null pointer dereference in zebra/kernel_netlink.c

CID 109898: Dereference null return value (NULL_RETURNS)
dereference: Dereferencing a pointer that might be NULL nest when calling nl_attr_nest_end.

Description:
Handled null check accordingly.

Signed-off-by: Harini Subramanian <[email protected]>
@Jafaral
Copy link
Member

Jafaral commented Nov 4, 2025

@Mergifyio backport dev/10.5 stable/10.4 stable/10.3

@mergify
Copy link

mergify bot commented Nov 4, 2025

backport dev/10.5 stable/10.4 stable/10.3

🟠 Waiting for conditions to match

  • merged [📌 backport requirement]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants