imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,15 +1,14 @@
 static void gw_node_add(struct bat_priv *bat_priv, struct orig_node *orig_node, uint8_t new_gwflags) {
   struct gw_node *gw_node;
   int down, up;
-  gw_node = kmalloc(sizeof(struct gw_node), GFP_ATOMIC);
+  gw_node = kzalloc(sizeof(struct gw_node), GFP_ATOMIC);
   if (!gw_node) return;
-  memset(gw_node, 0, sizeof(struct gw_node));
   INIT_HLIST_NODE(&gw_node->list);
   gw_node->orig_node = orig_node;
   atomic_set(&gw_node->refcount, 1);
   spin_lock_bh(&bat_priv->gw_list_lock);
   hlist_add_head_rcu(&gw_node->list, &bat_priv->gw_list);
   spin_unlock_bh(&bat_priv->gw_list_lock);
   gw_bandwidth_to_kbit(new_gwflags, &down, &up);
   bat_dbg(DBG_BATMAN, bat_priv, "Found new gateway %pM -> gw_class: %i - %i%s/%i%s\n", orig_node->orig, new_gwflags, (down > 2048 ? down / 1024 : down), (down > 2048 ? "MBit" : "KBit"), (up > 2048 ? up / 1024 : up), (up > 2048 ? "MBit" : "KBit"));
 }<sep>@@
expression e1,e2,e3;
identifier print1,print2;
constant char[] c1;
constant char[] c2;
statement S;
@@

-       e3 = kmalloc(e1, e2)
+       e3 = kzalloc(e1, e2)
        <... when != e3
(
	print1(...,c1,...,e3,...);
|
	kfree(e3);
)
       ...>
        if (e3 == NULL || ...) S
        <... when != e3
(
	print2(...,c2,...,e3,...);
|
	kfree(e3);
)
        ...>
-       memset(e3, 0, e1);
--- initial
+++ final
@@ -1,11 +1,10 @@
 static struct sdio_rx *alloc_rx_struct(struct rx_cxt *rx) {
   struct sdio_rx *r = NULL;
-  r = kmalloc(sizeof(*r), GFP_ATOMIC);
+  r = kzalloc(sizeof(*r), GFP_ATOMIC);
   if (r == NULL) goto out;
-  memset(r, 0, sizeof(*r));
   r->rx_cxt = rx;
   return r;
 out:
   kfree(r);
   return NULL;
 }<sep>@@
expression e1,e2,e3;
identifier print1,print2;
constant char[] c1;
constant char[] c2;
statement S;
@@

-       e3 = kmalloc(e1, e2)
+       e3 = kzalloc(e1, e2)
        <... when != e3
(
	print1(...,c1,...,e3,...);
|
	kfree(e3);
)
       ...>
        if (e3 == NULL || ...) S
        <... when != e3
(
	print2(...,c2,...,e3,...);
|
	kfree(e3);
)
        ...>
-       memset(e3, 0, e1);
--- initial
+++ final
@@ -1,34 +1,33 @@
 static dev_link_t *btuart_attach(void) {
   btuart_info_t *info;
   client_reg_t client_reg;
   dev_link_t *link;
   int ret;
   /* Create new info device */
-  info = kmalloc(sizeof(*info), GFP_KERNEL);
+  info = kzalloc(sizeof(*info), GFP_KERNEL);
   if (!info) return NULL;
-  memset(info, 0, sizeof(*info));
   link = &info->link;
   link->priv = info;
   link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
   link->io.NumPorts1 = 8;
   link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
   link->irq.IRQInfo1 = IRQ_LEVEL_ID;
   link->irq.Handler = btuart_interrupt;
   link->irq.Instance = info;
   link->conf.Attributes = CONF_ENABLE_IRQ;
   link->conf.Vcc = 50;
   link->conf.IntType = INT_MEMORY_AND_IO;
   /* Register with Card Services */
   link->next = dev_list;
   dev_list = link;
   client_reg.dev_info = &dev_info;
   client_reg.Version = 0x0210;
   client_reg.event_callback_args.client_data = link;
   ret = pcmcia_register_client(&link->handle, &client_reg);
   if (ret != CS_SUCCESS) {
     cs_error(link->handle, RegisterClient, ret);
     btuart_detach(link);
     return NULL;
   }
   return link;
 }<sep>@@
expression e1,e2,e3;
identifier print1,print2;
constant char[] c1;
constant char[] c2;
statement S;
@@

-       e3 = kmalloc(e1, e2)
+       e3 = kzalloc(e1, e2)
        <... when != e3
(
	print1(...,c1,...,e3,...);
|
	kfree(e3);
)
       ...>
        if (e3 == NULL || ...) S
        <... when != e3
(
	print2(...,c2,...,e3,...);
|
	kfree(e3);
)
        ...>
-       memset(e3, 0, e1);
--- initial
+++ final
@@ -1,51 +1,51 @@
 static int write_orph_node(struct ubifs_info *c, int atomic) {
   struct ubifs_orphan *orphan, *cnext;
   struct ubifs_orph_node *orph;
   int gap, err, len, cnt, i;
-  ubifs_assert(c->cmt_orphans > 0);
+  ubifs_assert(c, c->cmt_orphans > 0);
   gap = c->leb_size - c->ohead_offs;
   if (gap < UBIFS_ORPH_NODE_SZ + sizeof(__le64)) {
     c->ohead_lnum += 1;
     c->ohead_offs = 0;
     gap = c->leb_size;
     if (c->ohead_lnum > c->orph_last) {
       /*
        * We limit the number of orphans so that this should
        * never happen.
        */
       ubifs_err(c, "out of space in orphan area");
       return -EINVAL;
     }
   }
   cnt = (gap - UBIFS_ORPH_NODE_SZ) / sizeof(__le64);
   if (cnt > c->cmt_orphans) cnt = c->cmt_orphans;
   len = UBIFS_ORPH_NODE_SZ + cnt * sizeof(__le64);
-  ubifs_assert(c->orph_buf);
+  ubifs_assert(c, c->orph_buf);
   orph = c->orph_buf;
   orph->ch.node_type = UBIFS_ORPH_NODE;
   spin_lock(&c->orphan_lock);
   cnext = c->orph_cnext;
   for (i = 0; i < cnt; i++) {
     orphan = cnext;
-    ubifs_assert(orphan->cmt);
+    ubifs_assert(c, orphan->cmt);
     orph->inos[i] = cpu_to_le64(orphan->inum);
     orphan->cmt = 0;
     cnext = orphan->cnext;
     orphan->cnext = NULL;
   }
   c->orph_cnext = cnext;
   c->cmt_orphans -= cnt;
   spin_unlock(&c->orphan_lock);
   if (c->cmt_orphans)
     orph->cmt_no = cpu_to_le64(c->cmt_no);
   else
     /* Mark the last node of the commit */
     orph->cmt_no = cpu_to_le64((c->cmt_no) | (1ULL << 63));
-  ubifs_assert(c->ohead_offs + len <= c->leb_size);
-  ubifs_assert(c->ohead_lnum >= c->orph_first);
-  ubifs_assert(c->ohead_lnum <= c->orph_last);
+  ubifs_assert(c, c->ohead_offs + len <= c->leb_size);
+  ubifs_assert(c, c->ohead_lnum >= c->orph_first);
+  ubifs_assert(c, c->ohead_lnum <= c->orph_last);
   err = do_write_orph_node(c, len, atomic);
   c->ohead_offs += ALIGN(len, c->min_io_size);
   c->ohead_offs = ALIGN(c->ohead_offs, 8);
   return err;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,42 +1,42 @@
 int ubifs_bg_wbufs_sync(struct ubifs_info *c) {
   int err, i;
-  ubifs_assert(!c->ro_media && !c->ro_mount);
+  ubifs_assert(c, !c->ro_media && !c->ro_mount);
   if (!c->need_wbuf_sync) return 0;
   c->need_wbuf_sync = 0;
   if (c->ro_error) {
     err = -EROFS;
     goto out_timers;
   }
   dbg_io("synchronize");
   for (i = 0; i < c->jhead_cnt; i++) {
     struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;
     cond_resched();
     /*
      * If the mutex is locked then wbuf is being changed, so
      * synchronization is not necessary.
      */
     if (mutex_is_locked(&wbuf->io_mutex)) continue;
     mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);
     if (!wbuf->need_sync) {
       mutex_unlock(&wbuf->io_mutex);
       continue;
     }
     err = ubifs_wbuf_sync_nolock(wbuf);
     mutex_unlock(&wbuf->io_mutex);
     if (err) {
       ubifs_err(c, "cannot sync write-buffer, error %d", err);
       ubifs_ro_mode(c, err);
       goto out_timers;
     }
   }
   return 0;
 out_timers:
   /* Cancel all timers to prevent repeated errors */
   for (i = 0; i < c->jhead_cnt; i++) {
     struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;
     mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);
     cancel_wbuf_timer_nolock(wbuf);
     mutex_unlock(&wbuf->io_mutex);
   }
   return err;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,74 +1,74 @@
 int ubifs_jnl_delete_xattr(struct ubifs_info *c, const struct inode *host, const struct inode *inode, const struct fscrypt_name *nm) {
   int err, xlen, hlen, len, lnum, xent_offs, aligned_xlen;
   struct ubifs_dent_node *xent;
   struct ubifs_ino_node *ino;
   union ubifs_key xent_key, key1, key2;
   int sync = IS_DIRSYNC(host);
   struct ubifs_inode *host_ui = ubifs_inode(host);
-  ubifs_assert(inode->i_nlink == 0);
-  ubifs_assert(mutex_is_locked(&host_ui->ui_mutex));
+  ubifs_assert(c, inode->i_nlink == 0);
+  ubifs_assert(c, mutex_is_locked(&host_ui->ui_mutex));
   /*
    * Since we are deleting the inode, we do not bother to attach any data
    * to it and assume its length is %UBIFS_INO_NODE_SZ.
    */
   xlen = UBIFS_DENT_NODE_SZ + fname_len(nm) + 1;
   aligned_xlen = ALIGN(xlen, 8);
   hlen = host_ui->data_len + UBIFS_INO_NODE_SZ;
   len = aligned_xlen + UBIFS_INO_NODE_SZ + ALIGN(hlen, 8);
   xent = kzalloc(len, GFP_NOFS);
   if (!xent) return -ENOMEM;
   /* Make reservation before allocating sequence numbers */
   err = make_reservation(c, BASEHD, len);
   if (err) {
     kfree(xent);
     return err;
   }
   xent->ch.node_type = UBIFS_XENT_NODE;
   xent_key_init(c, &xent_key, host->i_ino, nm);
   key_write(c, &xent_key, xent->key);
   xent->inum = 0;
   xent->type = get_dent_type(inode->i_mode);
   xent->nlen = cpu_to_le16(fname_len(nm));
   memcpy(xent->name, fname_name(nm), fname_len(nm));
   xent->name[fname_len(nm)] = '\0';
   zero_dent_node_unused(xent);
   ubifs_prep_grp_node(c, xent, xlen, 0);
   ino = (void *)xent + aligned_xlen;
   pack_inode(c, ino, inode, 0);
   ino = (void *)ino + UBIFS_INO_NODE_SZ;
   pack_inode(c, ino, host, 1);
   err = write_head(c, BASEHD, xent, len, &lnum, &xent_offs, sync);
   if (!sync && !err) ubifs_wbuf_add_ino_nolock(&c->jheads[BASEHD].wbuf, host->i_ino);
   release_head(c, BASEHD);
   kfree(xent);
   if (err) goto out_ro;
   /* Remove the extended attribute entry from TNC */
   err = ubifs_tnc_remove_nm(c, &xent_key, nm);
   if (err) goto out_ro;
   err = ubifs_add_dirt(c, lnum, xlen);
   if (err) goto out_ro;
   /*
    * Remove all nodes belonging to the extended attribute inode from TNC.
    * Well, there actually must be only one node - the inode itself.
    */
   lowest_ino_key(c, &key1, inode->i_ino);
   highest_ino_key(c, &key2, inode->i_ino);
   err = ubifs_tnc_remove_range(c, &key1, &key2);
   if (err) goto out_ro;
   err = ubifs_add_dirt(c, lnum, UBIFS_INO_NODE_SZ);
   if (err) goto out_ro;
   /* And update TNC with the new host inode position */
   ino_key_init(c, &key1, host->i_ino);
   err = ubifs_tnc_add(c, &key1, lnum, xent_offs + len - hlen, hlen);
   if (err) goto out_ro;
   finish_reservation(c);
   spin_lock(&host_ui->ui_lock);
   host_ui->synced_i_size = host_ui->ui_size;
   spin_unlock(&host_ui->ui_lock);
   mark_inode_clean(c, host_ui);
   return 0;
 out_ro:
   ubifs_ro_mode(c, err);
   finish_reservation(c);
   return err;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,51 +1,51 @@
 static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, struct ubifs_znode *znode, int lnum, int offs, int len) {
   struct ubifs_znode *zp;
   int i, err;
   /* Make index node */
   idx->ch.node_type = UBIFS_IDX_NODE;
   idx->child_cnt = cpu_to_le16(znode->child_cnt);
   idx->level = cpu_to_le16(znode->level);
   for (i = 0; i < znode->child_cnt; i++) {
     struct ubifs_branch *br = ubifs_idx_branch(c, idx, i);
     struct ubifs_zbranch *zbr = &znode->zbranch[i];
     key_write_idx(c, &zbr->key, &br->key);
     br->lnum = cpu_to_le32(zbr->lnum);
     br->offs = cpu_to_le32(zbr->offs);
     br->len = cpu_to_le32(zbr->len);
     if (!zbr->lnum || !zbr->len) {
       ubifs_err(c, "bad ref in znode");
       ubifs_dump_znode(c, znode);
       if (zbr->znode) ubifs_dump_znode(c, zbr->znode);
       return -EINVAL;
     }
   }
   ubifs_prepare_node(c, idx, len, 0);
   znode->lnum = lnum;
   znode->offs = offs;
   znode->len = len;
   err = insert_old_idx_znode(c, znode);
   /* Update the parent */
   zp = znode->parent;
   if (zp) {
     struct ubifs_zbranch *zbr;
     zbr = &zp->zbranch[znode->iip];
     zbr->lnum = lnum;
     zbr->offs = offs;
     zbr->len = len;
   } else {
     c->zroot.lnum = lnum;
     c->zroot.offs = offs;
     c->zroot.len = len;
   }
   c->calc_idx_sz += ALIGN(len, 8);
   atomic_long_dec(&c->dirty_zn_cnt);
-  ubifs_assert(ubifs_zn_dirty(znode));
-  ubifs_assert(ubifs_zn_cow(znode));
+  ubifs_assert(c, ubifs_zn_dirty(znode));
+  ubifs_assert(c, ubifs_zn_cow(znode));
   /*
    * Note, unlike 'write_index()' we do not add memory barriers here
    * because this function is called with @c->tnc_mutex locked.
    */
   __clear_bit(DIRTY_ZNODE, &znode->flags);
   __clear_bit(COW_ZNODE, &znode->flags);
   return err;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,15 +1,15 @@
 int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len) {
   int err;
-  ubifs_assert(!c->ro_media && !c->ro_mount);
+  ubifs_assert(c, !c->ro_media && !c->ro_mount);
   if (c->ro_error) return -EROFS;
   if (!dbg_is_tst_rcvry(c))
     err = ubi_leb_change(c->ubi, lnum, buf, len);
   else
     err = dbg_leb_change(c, lnum, buf, len);
   if (err) {
     ubifs_err(c, "changing %d bytes in LEB %d failed, error %d", len, lnum, err);
     ubifs_ro_mode(c, err);
     dump_stack();
   }
   return err;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,24 +1,24 @@
 static struct ubifs_pnode *dirty_cow_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode) {
   struct ubifs_pnode *p;
   if (!test_bit(COW_CNODE, &pnode->flags)) {
     /* pnode is not being committed */
     if (!test_and_set_bit(DIRTY_CNODE, &pnode->flags)) {
       c->dirty_pn_cnt += 1;
       add_pnode_dirt(c, pnode);
     }
     return pnode;
   }
   /* pnode is being committed, so copy it */
   p = kmemdup(pnode, sizeof(struct ubifs_pnode), GFP_NOFS);
   if (unlikely(!p)) return ERR_PTR(-ENOMEM);
   p->cnext = NULL;
   __set_bit(DIRTY_CNODE, &p->flags);
   __clear_bit(COW_CNODE, &p->flags);
   replace_cats(c, pnode, p);
-  ubifs_assert(!test_bit(OBSOLETE_CNODE, &pnode->flags));
+  ubifs_assert(c, !test_bit(OBSOLETE_CNODE, &pnode->flags));
   __set_bit(OBSOLETE_CNODE, &pnode->flags);
   c->dirty_pn_cnt += 1;
   add_pnode_dirt(c, pnode);
   pnode->parent->nbranch[p->iip].pnode = p;
   return p;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,13 +1,13 @@
 static int check_lpt_crc(const struct ubifs_info *c, void *buf, int len) {
   int pos = 0;
   uint8_t *addr = buf;
   uint16_t crc, calc_crc;
-  crc = ubifs_unpack_bits(&addr, &pos, UBIFS_LPT_CRC_BITS);
+  crc = ubifs_unpack_bits(c, &addr, &pos, UBIFS_LPT_CRC_BITS);
   calc_crc = crc16(-1, buf + UBIFS_LPT_CRC_BYTES, len - UBIFS_LPT_CRC_BYTES);
   if (crc != calc_crc) {
     ubifs_err(c, "invalid crc in LPT node: crc %hx calc %hx", crc, calc_crc);
     dump_stack();
     return -EINVAL;
   }
   return 0;
 }<sep>@@
identifier f,c;
expression e1,e2,e3;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_unpack_bits(
+             c,
              e1,e2,e3)
...>
}
--- initial
+++ final
@@ -1,17 +1,17 @@
 static const struct ubifs_lprops *scan_for_leb_for_idx(struct ubifs_info *c) {
   const struct ubifs_lprops *lprops;
   struct scan_data data;
   int err;
   data.lnum = -1;
   err = ubifs_lpt_scan_nolock(c, -1, c->lscan_lnum, (ubifs_lpt_scan_callback)scan_for_idx_cb, &data);
   if (err) return ERR_PTR(err);
-  ubifs_assert(data.lnum >= c->main_first && data.lnum < c->leb_cnt);
+  ubifs_assert(c, data.lnum >= c->main_first && data.lnum < c->leb_cnt);
   c->lscan_lnum = data.lnum;
   lprops = ubifs_lpt_lookup_dirty(c, data.lnum);
   if (IS_ERR(lprops)) return lprops;
-  ubifs_assert(lprops->lnum == data.lnum);
-  ubifs_assert(lprops->free + lprops->dirty == c->leb_size);
-  ubifs_assert(!(lprops->flags & LPROPS_TAKEN));
-  ubifs_assert(!(lprops->flags & LPROPS_INDEX));
+  ubifs_assert(c, lprops->lnum == data.lnum);
+  ubifs_assert(c, lprops->free + lprops->dirty == c->leb_size);
+  ubifs_assert(c, !(lprops->flags & LPROPS_TAKEN));
+  ubifs_assert(c, !(lprops->flags & LPROPS_INDEX));
   return lprops;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,72 +1,72 @@
 static int populate_page(struct ubifs_info *c, struct page *page, struct bu_info *bu, int *n) {
   int i = 0, nn = *n, offs = bu->zbranch[0].offs, hole = 0, read = 0;
   struct inode *inode = page->mapping->host;
   loff_t i_size = i_size_read(inode);
   unsigned int page_block;
   void *addr, *zaddr;
   pgoff_t end_index;
   dbg_gen("ino %lu, pg %lu, i_size %lld, flags %#lx", inode->i_ino, page->index, i_size, page->flags);
   addr = zaddr = kmap(page);
   end_index = (i_size - 1) >> PAGE_SHIFT;
   if (!i_size || page->index > end_index) {
     hole = 1;
     memset(addr, 0, PAGE_SIZE);
     goto out_hole;
   }
   page_block = page->index << UBIFS_BLOCKS_PER_PAGE_SHIFT;
   while (1) {
     int err, len, out_len, dlen;
     if (nn >= bu->cnt) {
       hole = 1;
       memset(addr, 0, UBIFS_BLOCK_SIZE);
     } else if (key_block(c, &bu->zbranch[nn].key) == page_block) {
       struct ubifs_data_node *dn;
       dn = bu->buf + (bu->zbranch[nn].offs - offs);
-      ubifs_assert(le64_to_cpu(dn->ch.sqnum) > ubifs_inode(inode)->creat_sqnum);
+      ubifs_assert(c, le64_to_cpu(dn->ch.sqnum) > ubifs_inode(inode)->creat_sqnum);
       len = le32_to_cpu(dn->size);
       if (len <= 0 || len > UBIFS_BLOCK_SIZE) goto out_err;
       dlen = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ;
       out_len = UBIFS_BLOCK_SIZE;
       if (ubifs_crypt_is_encrypted(inode)) {
         err = ubifs_decrypt(inode, dn, &dlen, page_block);
         if (err) goto out_err;
       }
       err = ubifs_decompress(c, &dn->data, dlen, addr, &out_len, le16_to_cpu(dn->compr_type));
       if (err || len != out_len) goto out_err;
       if (len < UBIFS_BLOCK_SIZE) memset(addr + len, 0, UBIFS_BLOCK_SIZE - len);
       nn += 1;
       read = (i << UBIFS_BLOCK_SHIFT) + len;
     } else if (key_block(c, &bu->zbranch[nn].key) < page_block) {
       nn += 1;
       continue;
     } else {
       hole = 1;
       memset(addr, 0, UBIFS_BLOCK_SIZE);
     }
     if (++i >= UBIFS_BLOCKS_PER_PAGE) break;
     addr += UBIFS_BLOCK_SIZE;
     page_block += 1;
   }
   if (end_index == page->index) {
     int len = i_size & (PAGE_SIZE - 1);
     if (len && len < read) memset(zaddr + len, 0, read - len);
   }
 out_hole:
   if (hole) {
     SetPageChecked(page);
     dbg_gen("hole");
   }
   SetPageUptodate(page);
   ClearPageError(page);
   flush_dcache_page(page);
   kunmap(page);
   *n = nn;
   return 0;
 out_err:
   ClearPageUptodate(page);
   SetPageError(page);
   flush_dcache_page(page);
   kunmap(page);
   ubifs_err(c, "bad data node (block %u, inode %lu)", page_block, inode->i_ino);
   return -EINVAL;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,46 +1,46 @@
 int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, int row, int col) {
   struct ubifs_nnode *nnode, *nn;
   struct ubifs_cnode *cn;
   int num, iip = 0, err;
   if (!dbg_is_chk_lprops(c)) return 0;
   while (cnode) {
-    ubifs_assert(row >= 0);
+    ubifs_assert(c, row >= 0);
     nnode = cnode->parent;
     if (cnode->level) {
       /* cnode is a nnode */
       num = calc_nnode_num(row, col);
       if (cnode->num != num) {
         ubifs_err(c, "nnode num %d expected %d parent num %d iip %d", cnode->num, num, (nnode ? nnode->num : 0), cnode->iip);
         return -EINVAL;
       }
       nn = (struct ubifs_nnode *)cnode;
       while (iip < UBIFS_LPT_FANOUT) {
         cn = nn->nbranch[iip].cnode;
         if (cn) {
           /* Go down */
           row += 1;
           col <<= UBIFS_LPT_FANOUT_SHIFT;
           col += iip;
           iip = 0;
           cnode = cn;
           break;
         }
         /* Go right */
         iip += 1;
       }
       if (iip < UBIFS_LPT_FANOUT) continue;
     } else {
       struct ubifs_pnode *pnode;
       /* cnode is a pnode */
       pnode = (struct ubifs_pnode *)cnode;
       err = dbg_chk_pnode(c, pnode, col);
       if (err) return err;
     }
     /* Go up and to the right */
     row -= 1;
     col >>= UBIFS_LPT_FANOUT_SHIFT;
     iip = cnode->iip + 1;
     cnode = (struct ubifs_cnode *)nnode;
   }
   return 0;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}
--- initial
+++ final
@@ -1,82 +1,82 @@
 static int tnc_delete(struct ubifs_info *c, struct ubifs_znode *znode, int n) {
   struct ubifs_zbranch *zbr;
   struct ubifs_znode *zp;
   int i, err;
   /* Delete without merge for now */
-  ubifs_assert(znode->level == 0);
-  ubifs_assert(n >= 0 && n < c->fanout);
+  ubifs_assert(c, znode->level == 0);
+  ubifs_assert(c, n >= 0 && n < c->fanout);
   dbg_tnck(&znode->zbranch[n].key, "deleting key ");
   zbr = &znode->zbranch[n];
   lnc_free(zbr);
   err = ubifs_add_dirt(c, zbr->lnum, zbr->len);
   if (err) {
     ubifs_dump_znode(c, znode);
     return err;
   }
   /* We do not "gap" zbranch slots */
   for (i = n; i < znode->child_cnt - 1; i++)
     znode->zbranch[i] = znode->zbranch[i + 1];
   znode->child_cnt -= 1;
   if (znode->child_cnt > 0) return 0;
   /*
    * This was the last zbranch, we have to delete this znode from the
    * parent.
    */
   do {
-    ubifs_assert(!ubifs_zn_obsolete(znode));
-    ubifs_assert(ubifs_zn_dirty(znode));
+    ubifs_assert(c, !ubifs_zn_obsolete(znode));
+    ubifs_assert(c, ubifs_zn_dirty(znode));
     zp = znode->parent;
     n = znode->iip;
     atomic_long_dec(&c->dirty_zn_cnt);
     err = insert_old_idx_znode(c, znode);
     if (err) return err;
     if (znode->cnext) {
       __set_bit(OBSOLETE_ZNODE, &znode->flags);
       atomic_long_inc(&c->clean_zn_cnt);
       atomic_long_inc(&ubifs_clean_zn_cnt);
     } else
       kfree(znode);
     znode = zp;
   } while (znode->child_cnt == 1); /* while removing last child */
   /* Remove from znode, entry n - 1 */
   znode->child_cnt -= 1;
-  ubifs_assert(znode->level != 0);
+  ubifs_assert(c, znode->level != 0);
   for (i = n; i < znode->child_cnt; i++) {
     znode->zbranch[i] = znode->zbranch[i + 1];
     if (znode->zbranch[i].znode) znode->zbranch[i].znode->iip = i;
   }
   /*
    * If this is the root and it has only 1 child then
    * collapse the tree.
    */
   if (!znode->parent) {
     while (znode->child_cnt == 1 && znode->level != 0) {
       zp = znode;
       zbr = &znode->zbranch[0];
       znode = get_znode(c, znode, 0);
       if (IS_ERR(znode)) return PTR_ERR(znode);
       znode = dirty_cow_znode(c, zbr);
       if (IS_ERR(znode)) return PTR_ERR(znode);
       znode->parent = NULL;
       znode->iip = 0;
       if (c->zroot.len) {
         err = insert_old_idx(c, c->zroot.lnum, c->zroot.offs);
         if (err) return err;
       }
       c->zroot.lnum = zbr->lnum;
       c->zroot.offs = zbr->offs;
       c->zroot.len = zbr->len;
       c->zroot.znode = znode;
-      ubifs_assert(!ubifs_zn_obsolete(zp));
-      ubifs_assert(ubifs_zn_dirty(zp));
+      ubifs_assert(c, !ubifs_zn_obsolete(zp));
+      ubifs_assert(c, ubifs_zn_dirty(zp));
       atomic_long_dec(&c->dirty_zn_cnt);
       if (zp->cnext) {
         __set_bit(OBSOLETE_ZNODE, &zp->flags);
         atomic_long_inc(&c->clean_zn_cnt);
         atomic_long_inc(&ubifs_clean_zn_cnt);
       } else
         kfree(zp);
     }
   }
   return 0;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}