imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,60 +1,59 @@
 static int ohci_hcd_omap3_probe(struct platform_device *pdev) {
   struct device *dev = &pdev->dev;
   struct usb_hcd *hcd = NULL;
   void __iomem *regs = NULL;
   struct resource *res;
   int ret;
   int irq;
   if (usb_disabled()) return -ENODEV;
   if (!dev->parent) {
     dev_err(dev, "Missing parent device\n");
     return -ENODEV;
   }
   irq = platform_get_irq(pdev, 0);
   if (irq < 0) {
     dev_err(dev, "OHCI irq failed\n");
     return -ENODEV;
   }
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!res) {
     dev_err(dev, "UHH OHCI get resource failed\n");
     return -ENOMEM;
   }
   regs = ioremap(res->start, resource_size(res));
   if (!regs) {
     dev_err(dev, "UHH OHCI ioremap failed\n");
     return -ENOMEM;
   }
   /*
    * Right now device-tree probed devices don't get dma_mask set.
    * Since shared usb code relies on it, set it here for now.
    * Once we have dma capability bindings this can go away.
    */
-  if (!dev->dma_mask) dev->dma_mask = &dev->coherent_dma_mask;
-  ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+  ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
   if (ret) goto err_io;
   ret = -ENODEV;
   hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev, dev_name(dev));
   if (!hcd) {
     dev_err(dev, "usb_create_hcd failed\n");
     goto err_io;
   }
   hcd->rsrc_start = res->start;
   hcd->rsrc_len = resource_size(res);
   hcd->regs = regs;
   pm_runtime_enable(dev);
   pm_runtime_get_sync(dev);
   ohci_hcd_init(hcd_to_ohci(hcd));
   ret = usb_add_hcd(hcd, irq, 0);
   if (ret) {
     dev_dbg(dev, "failed to add hcd with err %d\n", ret);
     goto err_add_hcd;
   }
   return 0;
 err_add_hcd:
   pm_runtime_put_sync(dev);
   usb_put_hcd(hcd);
 err_io:
   iounmap(regs);
   return ret;
 }<sep>@@
expression ret,dev,v;
@@

-       if (!dev->dma_mask)
-               dev->dma_mask = &dev->coherent_dma_mask;
-       ret = dma_set_coherent_mask(dev, v);
+       ret = dma_coerce_mask_and_coherent(dev, v);
--- initial
+++ final
@@ -1,62 +1,61 @@
 static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) {
   const struct hc_driver *driver = &ohci_spear_hc_driver;
   struct usb_hcd *hcd = NULL;
   struct clk *usbh_clk;
   struct spear_ohci *ohci_p;
   struct resource *res;
   int retval, irq;
   irq = platform_get_irq(pdev, 0);
   if (irq < 0) {
     retval = irq;
     goto fail;
   }
   /*
    * Right now device-tree probed devices don't get dma_mask set.
    * Since shared usb code relies on it, set it here for now.
    * Once we have dma capability bindings this can go away.
    */
-  if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-  retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+  retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
   if (retval) goto fail;
   usbh_clk = devm_clk_get(&pdev->dev, NULL);
   if (IS_ERR(usbh_clk)) {
     dev_err(&pdev->dev, "Error getting interface clock\n");
     retval = PTR_ERR(usbh_clk);
     goto fail;
   }
   hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
   if (!hcd) {
     retval = -ENOMEM;
     goto fail;
   }
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!res) {
     retval = -ENODEV;
     goto err_put_hcd;
   }
   hcd->rsrc_start = pdev->resource[0].start;
   hcd->rsrc_len = resource_size(res);
   if (!devm_request_mem_region(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
     dev_dbg(&pdev->dev, "request_mem_region failed\n");
     retval = -EBUSY;
     goto err_put_hcd;
   }
   hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len);
   if (!hcd->regs) {
     dev_dbg(&pdev->dev, "ioremap failed\n");
     retval = -ENOMEM;
     goto err_put_hcd;
   }
   ohci_p = (struct spear_ohci *)hcd_to_ohci(hcd);
   ohci_p->clk = usbh_clk;
   spear_start_ohci(ohci_p);
   ohci_hcd_init(hcd_to_ohci(hcd));
   retval = usb_add_hcd(hcd, platform_get_irq(pdev, 0), 0);
   if (retval == 0) return retval;
   spear_stop_ohci(ohci_p);
 err_put_hcd:
   usb_put_hcd(hcd);
 fail:
   dev_err(&pdev->dev, "init fail, %d\n", retval);
   return retval;
 }<sep>@@
expression ret,dev,v;
@@

-       if (!dev.dma_mask)
-               dev.dma_mask = &dev.coherent_dma_mask;
-       ret = dma_set_coherent_mask(&dev, v);
+       ret = dma_coerce_mask_and_coherent(&dev, v);
--- initial
+++ final
@@ -1,43 +1,42 @@
 static int uhci_hcd_platform_probe(struct platform_device *pdev) {
   struct usb_hcd *hcd;
   struct uhci_hcd *uhci;
   struct resource *res;
   int ret;
   if (usb_disabled()) return -ENODEV;
   /*
    * Right now device-tree probed devices don't get dma_mask set.
    * Since shared usb code relies on it, set it here for now.
    * Once we have dma capability bindings this can go away.
    */
-  if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-  ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+  ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
   if (ret) return ret;
   hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, pdev->name);
   if (!hcd) return -ENOMEM;
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   hcd->rsrc_start = res->start;
   hcd->rsrc_len = resource_size(res);
   if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
     pr_err("%s: request_mem_region failed\n", __func__);
     ret = -EBUSY;
     goto err_rmr;
   }
   hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
   if (!hcd->regs) {
     pr_err("%s: ioremap failed\n", __func__);
     ret = -ENOMEM;
     goto err_irq;
   }
   uhci = hcd_to_uhci(hcd);
   uhci->regs = hcd->regs;
   ret = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED | IRQF_SHARED);
   if (ret) goto err_uhci;
   return 0;
 err_uhci:
   iounmap(hcd->regs);
 err_irq:
   release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
 err_rmr:
   usb_put_hcd(hcd);
   return ret;
 }<sep>@@
expression ret,dev,v;
@@

-       if (!dev.dma_mask)
-               dev.dma_mask = &dev.coherent_dma_mask;
-       ret = dma_set_coherent_mask(&dev, v);
+       ret = dma_coerce_mask_and_coherent(&dev, v);
--- initial
+++ final
@@ -1,8 +1,7 @@
 static void hash_sock_destruct(struct sock *sk) {
   struct alg_sock *ask = alg_sk(sk);
   struct hash_ctx *ctx = ask->private;
-  memzero_explicit(ctx->result, crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)));
-  sock_kfree_s(sk, ctx->result, crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)));
+  sock_kzfree_s(sk, ctx->result, crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)));
   sock_kfree_s(sk, ctx, ctx->len);
   af_alg_release_parent(sk);
 }<sep>@@
expression e1,e2,e3;
@@

-       memzero_explicit(e2, e3);
-       sock_kfree_s(e1, e2, e3);
+       sock_kzfree_s(e1, e2, e3);
--- initial
+++ final
@@ -1,10 +1,9 @@
 static void skcipher_sock_destruct(struct sock *sk) {
   struct alg_sock *ask = alg_sk(sk);
   struct skcipher_ctx *ctx = ask->private;
   struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(&ctx->req);
   skcipher_free_sgl(sk);
-  memzero_explicit(ctx->iv, crypto_ablkcipher_ivsize(tfm));
-  sock_kfree_s(sk, ctx->iv, crypto_ablkcipher_ivsize(tfm));
+  sock_kzfree_s(sk, ctx->iv, crypto_ablkcipher_ivsize(tfm));
   sock_kfree_s(sk, ctx, ctx->len);
   af_alg_release_parent(sk);
 }<sep>@@
expression e1,e2,e3;
@@

-       memzero_explicit(e2, e3);
-       sock_kfree_s(e1, e2, e3);
+       sock_kzfree_s(e1, e2, e3);
--- initial
+++ final
@@ -1,44 +1,44 @@
 int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, __u32 local_ip, __u32 peer_ip, int peer_port) {
   struct lnet_acceptor_connreq cr;
   struct socket *sock;
   int rc;
   int port;
   int fatal;
-  CLASSERT(sizeof(cr) <= 16); /* not too big to be on the stack */
+  BUILD_BUG_ON(sizeof(cr) > 16); /* not too big to be on the stack */
   for (port = LNET_ACCEPTOR_MAX_RESERVED_PORT; port >= LNET_ACCEPTOR_MIN_RESERVED_PORT; --port) {
     /* Iterate through reserved ports. */
     rc = lnet_sock_connect(&sock, &fatal, local_ip, port, peer_ip, peer_port);
     if (rc) {
       if (fatal) goto failed;
       continue;
     }
-    CLASSERT(LNET_PROTO_ACCEPTOR_VERSION == 1);
+    BUILD_BUG_ON(LNET_PROTO_ACCEPTOR_VERSION != 1);
     cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
     cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
     cr.acr_nid = peer_nid;
     if (the_lnet.ln_testprotocompat) {
       /* single-shot proto check */
       lnet_net_lock(LNET_LOCK_EX);
       if (the_lnet.ln_testprotocompat & 4) {
         cr.acr_version++;
         the_lnet.ln_testprotocompat &= ~4;
       }
       if (the_lnet.ln_testprotocompat & 8) {
         cr.acr_magic = LNET_PROTO_MAGIC;
         the_lnet.ln_testprotocompat &= ~8;
       }
       lnet_net_unlock(LNET_LOCK_EX);
     }
     rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout);
     if (rc) goto failed_sock;
     *sockp = sock;
     return 0;
   }
   rc = -EADDRINUSE;
   goto failed;
 failed_sock:
   sock_release(sock);
 failed:
   lnet_connect_console_error(rc, peer_nid, peer_ip, peer_port);
   return rc;
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 == e2);
+               BUILD_BUG_ON(e1 != e2);

@@
expression e1,e2;
@@
-               CLASSERT(e1 <= e2);
+               BUILD_BUG_ON(e1 > e2);
--- initial
+++ final
@@ -1,14 +1,14 @@
 void ptlrpc_init_xid(void) {
   time64_t now = ktime_get_real_seconds();
   spin_lock_init(&ptlrpc_last_xid_lock);
   if (now < YEAR_2004) {
     cfs_get_random_bytes(&ptlrpc_last_xid, sizeof(ptlrpc_last_xid));
     ptlrpc_last_xid >>= 2;
     ptlrpc_last_xid |= (1ULL << 61);
   } else {
     ptlrpc_last_xid = (__u64)now << 20;
   }
   /* Always need to be aligned to a power-of-two for multi-bulk BRW */
-  CLASSERT(((PTLRPC_BULK_OPS_COUNT - 1) & PTLRPC_BULK_OPS_COUNT) == 0);
+  BUILD_BUG_ON(((PTLRPC_BULK_OPS_COUNT - 1) & PTLRPC_BULK_OPS_COUNT) != 0);
   ptlrpc_last_xid &= PTLRPC_BULK_OPS_MASK;
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 == e2);
+               BUILD_BUG_ON(e1 != e2);
--- initial
+++ final
@@ -1,26 +1,26 @@
 void *ptlrpcd_alloc_work(struct obd_import *imp, int (*cb)(const struct lu_env *, void *), void *cbdata) {
   struct ptlrpc_request *req = NULL;
   struct ptlrpc_work_async_args *args;
   might_sleep();
   if (!cb) return ERR_PTR(-EINVAL);
   /* copy some code from deprecated fakereq. */
   req = ptlrpc_request_cache_alloc(GFP_NOFS);
   if (!req) {
     CERROR("ptlrpc: run out of memory!\n");
     return ERR_PTR(-ENOMEM);
   }
   ptlrpc_cli_req_init(req);
   req->rq_send_state = LUSTRE_IMP_FULL;
   req->rq_type = PTL_RPC_MSG_REQUEST;
   req->rq_import = class_import_get(imp);
   req->rq_interpret_reply = work_interpreter;
   /* don't want reply */
   req->rq_no_delay = 1;
   req->rq_no_resend = 1;
   req->rq_pill.rc_fmt = (void *)&worker_format;
-  CLASSERT(sizeof(*args) <= sizeof(req->rq_async_args));
+  BUILD_BUG_ON(sizeof(*args) > sizeof(req->rq_async_args));
   args = ptlrpc_req_async_args(req);
   args->cb = cb;
   args->cbdata = cbdata;
   return req;
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 <= e2);
+               BUILD_BUG_ON(e1 > e2);
--- initial
+++ final
@@ -1,42 +1,42 @@
 struct cfs_hash *cfs_hash_create(char *name, unsigned int cur_bits, unsigned int max_bits, unsigned int bkt_bits, unsigned int extra_bytes, unsigned int min_theta, unsigned int max_theta, struct cfs_hash_ops *ops, unsigned int flags) {
   struct cfs_hash *hs;
   int len;
-  CLASSERT(CFS_HASH_THETA_BITS < 15);
+  BUILD_BUG_ON(CFS_HASH_THETA_BITS >= 15);
   LASSERT(name);
   LASSERT(ops->hs_key);
   LASSERT(ops->hs_hash);
   LASSERT(ops->hs_object);
   LASSERT(ops->hs_keycmp);
   LASSERT(ops->hs_get);
   LASSERT(ops->hs_put_locked);
   if (flags & CFS_HASH_REHASH) flags |= CFS_HASH_COUNTER; /* must have counter */
   LASSERT(cur_bits > 0);
   LASSERT(cur_bits >= bkt_bits);
   LASSERT(max_bits >= cur_bits && max_bits < 31);
   LASSERT(ergo(!(flags & CFS_HASH_REHASH), cur_bits == max_bits));
   LASSERT(ergo(flags & CFS_HASH_REHASH, !(flags & CFS_HASH_NO_LOCK)));
   LASSERT(ergo(flags & CFS_HASH_REHASH_KEY, ops->hs_keycpy));
   len = !(flags & CFS_HASH_BIGNAME) ? CFS_HASH_NAME_LEN : CFS_HASH_BIGNAME_LEN;
   LIBCFS_ALLOC(hs, offsetof(struct cfs_hash, hs_name[len]));
   if (!hs) return NULL;
   strlcpy(hs->hs_name, name, len);
   hs->hs_flags = flags;
   atomic_set(&hs->hs_refcount, 1);
   atomic_set(&hs->hs_count, 0);
   cfs_hash_lock_setup(hs);
   cfs_hash_hlist_setup(hs);
   hs->hs_cur_bits = (u8)cur_bits;
   hs->hs_min_bits = (u8)cur_bits;
   hs->hs_max_bits = (u8)max_bits;
   hs->hs_bkt_bits = (u8)bkt_bits;
   hs->hs_ops = ops;
   hs->hs_extra_bytes = extra_bytes;
   hs->hs_rehash_bits = 0;
   cfs_wi_init(&hs->hs_rehash_wi, hs, cfs_hash_rehash_worker);
   cfs_hash_depth_wi_init(hs);
   if (cfs_hash_with_rehash(hs)) __cfs_hash_set_theta(hs, min_theta, max_theta);
   hs->hs_buckets = cfs_hash_buckets_realloc(hs, NULL, 0, CFS_HASH_NBKT(hs));
   if (hs->hs_buckets) return hs;
   LIBCFS_FREE(hs, offsetof(struct cfs_hash, hs_name[len]));
   return NULL;
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 < e2);
+               BUILD_BUG_ON(e1 >= e2);
--- initial
+++ final
@@ -1,67 +1,67 @@
 static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock) {
   struct ptlrpc_request *req;
   struct ldlm_async_args *aa;
   struct ldlm_request *body;
   int flags;
   /* Bug 11974: Do not replay a lock which is actively being canceled */
   if (ldlm_is_bl_done(lock)) {
     LDLM_DEBUG(lock, "Not replaying canceled lock:");
     return 0;
   }
   /* If this is reply-less callback lock, we cannot replay it, since
    * server might have long dropped it, but notification of that event was
    * lost by network. (and server granted conflicting lock already)
    */
   if (ldlm_is_cancel_on_block(lock)) {
     LDLM_DEBUG(lock, "Not replaying reply-less lock:");
     ldlm_lock_cancel(lock);
     return 0;
   }
   /*
    * If granted mode matches the requested mode, this lock is granted.
    *
    * If they differ, but we have a granted mode, then we were granted
    * one mode and now want another: ergo, converting.
    *
    * If we haven't been granted anything and are on a resource list,
    * then we're blocked/waiting.
    *
    * If we haven't been granted anything and we're NOT on a resource list,
    * then we haven't got a reply yet and don't have a known disposition.
    * This happens whenever a lock enqueue is the request that triggers
    * recovery.
    */
   if (lock->l_granted_mode == lock->l_req_mode)
     flags = LDLM_FL_REPLAY | LDLM_FL_BLOCK_GRANTED;
   else if (lock->l_granted_mode)
     flags = LDLM_FL_REPLAY | LDLM_FL_BLOCK_CONV;
   else if (!list_empty(&lock->l_res_link))
     flags = LDLM_FL_REPLAY | LDLM_FL_BLOCK_WAIT;
   else
     flags = LDLM_FL_REPLAY;
   req = ptlrpc_request_alloc_pack(imp, &RQF_LDLM_ENQUEUE, LUSTRE_DLM_VERSION, LDLM_ENQUEUE);
   if (!req) return -ENOMEM;
   /* We're part of recovery, so don't wait for it. */
   req->rq_send_state = LUSTRE_IMP_REPLAY_LOCKS;
   body = req_capsule_client_get(&req->rq_pill, &RMF_DLM_REQ);
   ldlm_lock2desc(lock, &body->lock_desc);
   body->lock_flags = ldlm_flags_to_wire(flags);
   ldlm_lock2handle(lock, &body->lock_handle[0]);
   if (lock->l_lvb_len > 0) req_capsule_extend(&req->rq_pill, &RQF_LDLM_ENQUEUE_LVB);
   req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, lock->l_lvb_len);
   ptlrpc_request_set_replen(req);
   /* notify the server we've replayed all requests.
    * also, we mark the request to be put on a dedicated
    * queue to be processed after all request replayes.
    * bug 6063
    */
   lustre_msg_set_flags(req->rq_reqmsg, MSG_REQ_REPLAY_DONE);
   LDLM_DEBUG(lock, "replaying lock:");
   atomic_inc(&req->rq_import->imp_replay_inflight);
-  CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
+  BUILD_BUG_ON(sizeof(*aa) > sizeof(req->rq_async_args));
   aa = ptlrpc_req_async_args(req);
   aa->lock_handle = body->lock_handle[0];
   req->rq_interpret_reply = (ptlrpc_interpterer_t)replay_lock_interpret;
   ptlrpcd_add_req(req);
   return 0;
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 <= e2);
+               BUILD_BUG_ON(e1 > e2);
--- initial
+++ final
@@ -1,21 +1,21 @@
 void ldlm_resource_dump(int level, struct ldlm_resource *res) {
   struct ldlm_lock *lock;
   unsigned int granted = 0;
-  CLASSERT(RES_NAME_SIZE == 4);
+  BUILD_BUG_ON(RES_NAME_SIZE != 4);
   if (!((libcfs_debug | D_ERROR) & level)) return;
   CDEBUG(level, "--- Resource: " DLDLMRES " (%p) refcount = %d\n", PLDLMRES(res), res, atomic_read(&res->lr_refcount));
   if (!list_empty(&res->lr_granted)) {
     CDEBUG(level, "Granted locks (in reverse order):\n");
     list_for_each_entry_reverse(lock, &res->lr_granted, l_res_link) {
       LDLM_DEBUG_LIMIT(level, lock, "###");
       if (!(level & D_CANTMASK) && ++granted > ldlm_dump_granted_max) {
         CDEBUG(level, "only dump %d granted locks to avoid DDOS.\n", granted);
         break;
       }
     }
   }
   if (!list_empty(&res->lr_waiting)) {
     CDEBUG(level, "Waiting locks:\n");
     list_for_each_entry(lock, &res->lr_waiting, l_res_link) LDLM_DEBUG_LIMIT(level, lock, "###");
   }
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 == e2);
+               BUILD_BUG_ON(e1 != e2);
--- initial
+++ final
@@ -1,47 +1,47 @@
 int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask) {
   struct ifreq ifr;
   int nob;
   int rc;
   __u32 val;
   nob = strnlen(name, IFNAMSIZ);
   if (nob == IFNAMSIZ) {
     CERROR("Interface name %s too long\n", name);
     return -EINVAL;
   }
-  CLASSERT(sizeof(ifr.ifr_name) >= IFNAMSIZ);
+  BUILD_BUG_ON(IFNAMSIZ > sizeof(ifr.ifr_name));
   if (strlen(name) > sizeof(ifr.ifr_name) - 1) return -E2BIG;
   strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
   rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr);
   if (rc) {
     CERROR("Can't get flags for interface %s\n", name);
     return rc;
   }
   if (!(ifr.ifr_flags & IFF_UP)) {
     CDEBUG(D_NET, "Interface %s down\n", name);
     *up = 0;
     *ip = *mask = 0;
     return 0;
   }
   *up = 1;
   if (strlen(name) > sizeof(ifr.ifr_name) - 1) return -E2BIG;
   strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
   ifr.ifr_addr.sa_family = AF_INET;
   rc = lnet_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr);
   if (rc) {
     CERROR("Can't get IP address for interface %s\n", name);
     return rc;
   }
   val = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr;
   *ip = ntohl(val);
   if (strlen(name) > sizeof(ifr.ifr_name) - 1) return -E2BIG;
   strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
   ifr.ifr_addr.sa_family = AF_INET;
   rc = lnet_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr);
   if (rc) {
     CERROR("Can't get netmask for interface %s\n", name);
     return rc;
   }
   val = ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr;
   *mask = ntohl(val);
   return 0;
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 <= e2);
+               BUILD_BUG_ON(e1 > e2);
--- initial
+++ final
@@ -1,34 +1,34 @@
 ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, size_t buf_size) {
   struct lov_ost_data_v1 *lmm_objects;
   struct lov_mds_md_v1 *lmmv1 = buf;
   struct lov_mds_md_v3 *lmmv3 = buf;
   size_t lmm_size;
   unsigned int i;
   lmm_size = lov_mds_md_size(lsm->lsm_stripe_count, lsm->lsm_magic);
   if (!buf_size) return lmm_size;
   if (buf_size < lmm_size) return -ERANGE;
   /*
    * lmmv1 and lmmv3 point to the same struct and have the
    * same first fields
    */
   lmmv1->lmm_magic = cpu_to_le32(lsm->lsm_magic);
   lmm_oi_cpu_to_le(&lmmv1->lmm_oi, &lsm->lsm_oi);
   lmmv1->lmm_stripe_size = cpu_to_le32(lsm->lsm_stripe_size);
   lmmv1->lmm_stripe_count = cpu_to_le16(lsm->lsm_stripe_count);
   lmmv1->lmm_pattern = cpu_to_le32(lsm->lsm_pattern);
   lmmv1->lmm_layout_gen = cpu_to_le16(lsm->lsm_layout_gen);
   if (lsm->lsm_magic == LOV_MAGIC_V3) {
-    CLASSERT(sizeof(lsm->lsm_pool_name) == sizeof(lmmv3->lmm_pool_name));
+    BUILD_BUG_ON(sizeof(lsm->lsm_pool_name) != sizeof(lmmv3->lmm_pool_name));
     strlcpy(lmmv3->lmm_pool_name, lsm->lsm_pool_name, sizeof(lmmv3->lmm_pool_name));
     lmm_objects = lmmv3->lmm_objects;
   } else {
     lmm_objects = lmmv1->lmm_objects;
   }
   for (i = 0; i < lsm->lsm_stripe_count; i++) {
     struct lov_oinfo *loi = lsm->lsm_oinfo[i];
     ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi);
     lmm_objects[i].l_ost_gen = cpu_to_le32(loi->loi_ost_gen);
     lmm_objects[i].l_ost_idx = cpu_to_le32(loi->loi_ost_idx);
   }
   return lmm_size;
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 == e2);
+               BUILD_BUG_ON(e1 != e2);
--- initial
+++ final
@@ -1,28 +1,28 @@
 void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data, const void *data, size_t datalen, umode_t mode, uid_t uid, gid_t gid, cfs_cap_t cap_effective, __u64 rdev) {
   struct mdt_rec_create *rec;
   char *tmp;
   __u64 flags;
-  CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_create));
+  BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_create));
   rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
   rec->cr_opcode = REINT_CREATE;
   rec->cr_fsuid = uid;
   rec->cr_fsgid = gid;
   rec->cr_cap = cap_effective;
   rec->cr_fid1 = op_data->op_fid1;
   rec->cr_fid2 = op_data->op_fid2;
   rec->cr_mode = mode;
   rec->cr_rdev = rdev;
   rec->cr_time = op_data->op_mod_time;
   rec->cr_suppgid1 = op_data->op_suppgids[0];
   rec->cr_suppgid2 = op_data->op_suppgids[1];
   flags = 0;
   if (op_data->op_bias & MDS_CREATE_VOLATILE) flags |= MDS_OPEN_VOLATILE;
   set_mrc_cr_flags(rec, flags);
   rec->cr_bias = op_data->op_bias;
   rec->cr_umask = current_umask();
   mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
   if (data) {
     tmp = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
     memcpy(tmp, data, datalen);
   }
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 == e2);
+               BUILD_BUG_ON(e1 != e2);
--- initial
+++ final
@@ -1,16 +1,16 @@
 void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data) {
   struct mdt_rec_link *rec;
-  CLASSERT(sizeof(struct mdt_rec_reint) == sizeof(struct mdt_rec_link));
+  BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_link));
   rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
   rec->lk_opcode = REINT_LINK;
   rec->lk_fsuid = op_data->op_fsuid; /* current->fsuid; */
   rec->lk_fsgid = op_data->op_fsgid; /* current->fsgid; */
   rec->lk_cap = op_data->op_cap;     /* current->cap_effective; */
   rec->lk_suppgid1 = op_data->op_suppgids[0];
   rec->lk_suppgid2 = op_data->op_suppgids[1];
   rec->lk_fid1 = op_data->op_fid1;
   rec->lk_fid2 = op_data->op_fid2;
   rec->lk_time = op_data->op_mod_time;
   rec->lk_bias = op_data->op_bias;
   mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
 }<sep>@@
expression e1,e2;
@@
-               CLASSERT(e1 == e2);
+               BUILD_BUG_ON(e1 != e2);