Skip to contentSkip to conversation

staging: vchiq_arm: pass vchiq instance to 'handle_to_service'

bug report Dan Carpenter 1 participant 1 message Jun 13, 2022 Staging

lore
Share & tools
lore
#0 lore raw

Hello Adrien Thierry,

This is a semi-automatic email about new static checker warnings.

The patch 6d02150cdf76: "staging: vchiq_arm: pass vchiq instance to 'handle_to_service'" from May 18, 2022, leads to the following Smatch complaint:

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1070 service_callback()
warn: variable dereferenced before check 'instance' (see line 1062)

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
1061 rcu_read_lock();

  1062		service = handle_to_service(instance, handle);
                                            ^^^^^^^^

New dereference

1063 if (WARN_ON(!service)) {
1064 rcu_read_unlock();
1065 return VCHIQ_SUCCESS;
1066 }
1067
1068 user_service = (struct user_service *)service->base.userdata;
1069

  1070		if (!instance || instance->closing) {
                     ^^^^^^^^

Existing code checked for NULL

  1071			rcu_read_unlock();
  1072			return VCHIQ_SUCCESS;

regards,
dan carpenter