Hello,

My software development attention was caught also by a recent patch.
https://lore.kernel.org/linux-fsdevel/20200608141629.GA1912173@mwanda/
https://lore.kernel.org/patchwork/patch/1253499/

Thus I have tried another tiny script out for the semantic patch language
(according to the software combination “Coccinelle 1.0.8-00104-ge06b9156”).


@display@
expression e, x, y;
@@
*brelse(e);
*y = x(<+... e ...+>, ...);


An usable output is generated then as expected for a test source file
like the following.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/fs/exfat/nls.c?id=b676fdbcf4c8424f3c02ed7f31576d99b963bded#n652

// SPDX-License-Identifier: GPL-2.0-or-later
// deleted part
static int exfat_load_upcase_table(struct super_block *sb,
                sector_t sector, unsigned long long num_sectors,
                unsigned int utbl_checksum)
{
        struct exfat_sb_info *sbi = EXFAT_SB(sb);
        unsigned int sect_size = sb->s_blocksize;
        unsigned int i, index = 0;
        u32 chksum = 0;
// deleted part
        while (sector < num_sectors) {
                struct buffer_head *bh;

                bh = sb_bread(sb, sector);
// deleted part
                brelse(bh);
                chksum = exfat_calc_chksum32(bh->b_data, i, chksum, CS_DEFAULT);
        }
// deleted part
}
// deleted part


If I omit the specification “, ...” from the function call parameters
because I could be unsure about the number of arguments in other
software situations, I do not get the desired test output as before.

If I omit even the semicolon from the assignment statement in the
search pattern, I get an error message.

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci 
show_questionable_brelse_usage6.cocci
…
minus: parse error:
  File "show_questionable_brelse_usage6.cocci", line 6, column 0, charpos = 67
  around = '',
  whole content =


Will such observations influence subsequent software evolution?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to