Примеры ошибок, обнаруженных с помощью диагностики V1020
V1020. Function exited without performing epilogue actions. It is possible that there is an error.
Zephyr
V1020 The function exited without calling the 'k_mutex_unlock' function. Check lines: 620, 549. nvs.c 620
static int nvs_startup(struct nvs_fs *fs)
{
....
k_mutex_lock(&fs->nvs_lock, K_FOREVER);
....
if (fs->ate_wra == fs->data_wra && last_ate.len) {
return -ESPIPE;
}
....
end:
k_mutex_unlock(&fs->nvs_lock);
return rc;
}
Similar errors can be found in some other places:
- V1020 The function exited without calling the 'k_mutex_unlock' function. Check lines: 574, 549. nvs.c 574
- V1020 The function exited without calling the 'k_mutex_unlock' function. Check lines: 908, 890. net_context.c 908
- V1020 The function exited without calling the 'k_mutex_unlock' function. Check lines: 1194, 1189. shell.c 1194
iSulad
V1020 [CWE-772] The function exited without calling the 'mutex_unlock' function. Check lines: 502, 495. local.c 502
struct volumes *local_volume_list(void)
{
int ret = 0;
map_itor *itor = NULL;
struct volume *vol = NULL;
struct volume *v = NULL;
struct volumes *vols = NULL;
size_t size = 0;
mutex_lock(&g_volumes->mutex);
size = map_size(g_volumes->vols_by_name);
vols = new_empty_volumes(size);
if (vols == NULL) {
ERROR("out of memory");
return NULL;
}
itor = map_itor_new(g_volumes->vols_by_name);
if (itor == NULL) {
ERROR("failed to get volumes's iterator to get all volumes");
ret = -1;
goto out;
}
....
out:
map_itor_free(itor);
mutex_unlock(&g_volumes->mutex);
if (ret != 0) {
free_volumes(vols);
vols = NULL;
}
return vols;
}
DPDK
V1020 The function exited without calling the 'rte_spinlock_unlock' function. Check lines: 2149, 2136. qman.c 2149
#define spin_lock(x) rte_spinlock_lock(x)
#define spin_unlock(x) rte_spinlock_unlock(x)
#define FQLOCK(fq) \
do { \
struct qman_fq *__fq478 = (fq); \
if (fq_isset(__fq478, QMAN_FQ_FLAG_LOCKED)) \
spin_lock(&__fq478->fqlock); \
} while (0)
#define FQUNLOCK(fq) \
do { \
struct qman_fq *__fq478 = (fq); \
if (fq_isset(__fq478, QMAN_FQ_FLAG_LOCKED)) \
spin_unlock(&__fq478->fqlock); \
} while (0)
int qman_set_vdq(struct qman_fq *fq, u16 num, uint32_t vdqcr_flags)
{
....
if (!p->vdqcr_owned) {
FQLOCK(fq);
if (fq_isset(fq, QMAN_FQ_STATE_VDQCR))
goto escape;
fq_set(fq, QMAN_FQ_STATE_VDQCR);
FQUNLOCK(fq);
p->vdqcr_owned = fq;
ret = 0;
}
escape:
if (!ret)
qm_dqrr_vdqcr_set(&p->p, vdqcr);
out:
return ret;
}
Similar errors can be found in some other places:
- V1020 The function exited without calling the 'rte_spinlock_unlock' function. Check lines: 2180, 2170. qman.c 2180
- V1020 The function exited without calling the 'rte_spinlock_unlock' function. Check lines: 2184, 2170. qman.c 2184
DPDK
V1020 The function exited without calling the 'rte_spinlock_unlock' function. Check lines: 144, 141. l2fwd_event.c 144
static __rte_noinline int
l2fwd_get_free_event_port(struct l2fwd_event_resources *evt_rsrc)
{
static int index;
int port_id;
rte_spinlock_lock(&evt_rsrc->evp.lock);
if (index >= evt_rsrc->evp.nb_ports) {
printf("No free event port is available\n");
return -1;
}
port_id = evt_rsrc->evp.event_p_id[index];
index++;
rte_spinlock_unlock(&evt_rsrc->evp.lock);
return port_id;
}
Similar errors can be found in some other places:
- V1020 The function exited without calling the 'rte_spinlock_unlock' function. Check lines: 209, 206. l3fwd_event.c 209