summary refs log tree commit diff stats
path: root/results/classifier/zero-shot/105/mistranslation/1735
blob: f7ad04caaf13bf39d16b1de505b3eaf934653de6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
mistranslation: 0.657
vnc: 0.643
network: 0.415
device: 0.391
graphic: 0.338
assembly: 0.330
socket: 0.293
other: 0.290
KVM: 0.288
instruction: 0.233
boot: 0.219
semantic: 0.168

[riscv-pmp] Pmp_hart_has_privs local variable name easily misunderstood
Additional information:
```c
// int => bool 
static int pmp_is_in_range(CPURISCVState *env, int pmp_index,
                           target_ulong addr);

bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
                        target_ulong size, pmp_priv_t privs,
                        pmp_priv_t *allowed_privs, target_ulong mode)
{
    int i = 0;
    int pmp_size = 0;
    // easily misunderstood local variable 
    target_ulong s = 0;
    target_ulong e = 0;

    for (i = 0; i < MAX_RISCV_PMPS; i++) {
        s = pmp_is_in_range(env, i, addr);
        e = pmp_is_in_range(env, i, addr + pmp_size - 1);

        /* partially inside */
        if ((s + e) == 1) {
          
        }

        /* fully inside */
        if ((s + e) == 2) {
```