imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,60 +1,60 @@
 static int axon_msi_probe(struct platform_device *device) {
   struct device_node *dn = device->dev.of_node;
   struct axon_msic *msic;
   unsigned int virq;
   int dcr_base, dcr_len;
   pr_devel("axon_msi: setting up dn %pOF\n", dn);
-  msic = kzalloc(sizeof(struct axon_msic), GFP_KERNEL);
+  msic = kzalloc(sizeof(*msic), GFP_KERNEL);
   if (!msic) {
     printk(KERN_ERR "axon_msi: couldn't allocate msic for %pOF\n", dn);
     goto out;
   }
   dcr_base = dcr_resource_start(dn, 0);
   dcr_len = dcr_resource_len(dn, 0);
   if (dcr_base == 0 || dcr_len == 0) {
     printk(KERN_ERR "axon_msi: couldn't parse dcr properties on %pOF\n", dn);
     goto out_free_msic;
   }
   msic->dcr_host = dcr_map(dn, dcr_base, dcr_len);
   if (!DCR_MAP_OK(msic->dcr_host)) {
     printk(KERN_ERR "axon_msi: dcr_map failed for %pOF\n", dn);
     goto out_free_msic;
   }
   msic->fifo_virt = dma_alloc_coherent(&device->dev, MSIC_FIFO_SIZE_BYTES, &msic->fifo_phys, GFP_KERNEL);
   if (!msic->fifo_virt) {
     printk(KERN_ERR "axon_msi: couldn't allocate fifo for %pOF\n", dn);
     goto out_free_msic;
   }
   virq = irq_of_parse_and_map(dn, 0);
   if (!virq) {
     printk(KERN_ERR "axon_msi: irq parse and map failed for %pOF\n", dn);
     goto out_free_fifo;
   }
   memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES);
   /* We rely on being able to stash a virq in a u16, so limit irqs to < 65536 */
   msic->irq_domain = irq_domain_add_nomap(dn, 65536, &msic_host_ops, msic);
   if (!msic->irq_domain) {
     printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %pOF\n", dn);
     goto out_free_fifo;
   }
   irq_set_handler_data(virq, msic);
   irq_set_chained_handler(virq, axon_msi_cascade);
   pr_devel("axon_msi: irq 0x%x setup for axon_msi\n", virq);
   /* Enable the MSIC hardware */
   msic_dcr_write(msic, MSIC_BASE_ADDR_HI_REG, msic->fifo_phys >> 32);
   msic_dcr_write(msic, MSIC_BASE_ADDR_LO_REG, msic->fifo_phys & 0xFFFFFFFF);
   msic_dcr_write(msic, MSIC_CTRL_REG, MSIC_CTRL_IRQ_ENABLE | MSIC_CTRL_ENABLE | MSIC_CTRL_FIFO_SIZE);
   msic->read_offset = dcr_read(msic->dcr_host, MSIC_WRITE_OFFSET_REG) & MSIC_FIFO_SIZE_MASK;
   dev_set_drvdata(&device->dev, msic);
   cell_pci_controller_ops.setup_msi_irqs = axon_msi_setup_msi_irqs;
   cell_pci_controller_ops.teardown_msi_irqs = axon_msi_teardown_msi_irqs;
   axon_msi_debug_setup(dn, msic);
   printk(KERN_DEBUG "axon_msi: setup MSIC on %pOF\n", dn);
   return 0;
 out_free_fifo:
   dma_free_coherent(&device->dev, MSIC_FIFO_SIZE_BYTES, msic->fifo_virt, msic->fifo_phys);
 out_free_msic:
   kfree(msic);
 out:
   return -1;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,19 +1,19 @@
 static void __init kw_i2c_add(struct pmac_i2c_host_kw *host, struct device_node *controller, struct device_node *busnode, int channel) {
   struct pmac_i2c_bus *bus;
-  bus = kzalloc(sizeof(struct pmac_i2c_bus), GFP_KERNEL);
+  bus = kzalloc(sizeof(*bus), GFP_KERNEL);
   if (bus == NULL) return;
   bus->controller = of_node_get(controller);
   bus->busnode = of_node_get(busnode);
   bus->type = pmac_i2c_bus_keywest;
   bus->hostdata = host;
   bus->channel = channel;
   bus->mode = pmac_i2c_mode_std;
   bus->open = kw_i2c_open;
   bus->close = kw_i2c_close;
   bus->xfer = kw_i2c_xfer;
   mutex_init(&bus->mutex);
   lockdep_set_class(&bus->mutex, &bus->lock_key);
   if (controller == busnode) bus->flags = pmac_i2c_multibus;
   list_add(&bus->link, &pmac_i2c_busses);
   printk(KERN_INFO " channel %d bus %s\n", channel, (controller == busnode) ? "<multibus>" : busnode->full_name);
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,53 +1,53 @@
 static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) {
   struct pmac_i2c_host_kw *host;
   const u32 *psteps, *prate, *addrp;
   u32 steps;
-  host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL);
+  host = kzalloc(sizeof(*host), GFP_KERNEL);
   if (host == NULL) {
     printk(KERN_ERR "low_i2c: Can't allocate host for %pOF\n", np);
     return NULL;
   }
   /* Apple is kind enough to provide a valid AAPL,address property
    * on all i2c keywest nodes so far ... we would have to fallback
    * to macio parsing if that wasn't the case
    */
   addrp = of_get_property(np, "AAPL,address", NULL);
   if (addrp == NULL) {
     printk(KERN_ERR "low_i2c: Can't find address for %pOF\n", np);
     kfree(host);
     return NULL;
   }
   mutex_init(&host->mutex);
   init_completion(&host->complete);
   spin_lock_init(&host->lock);
   timer_setup(&host->timeout_timer, kw_i2c_timeout, 0);
   psteps = of_get_property(np, "AAPL,address-step", NULL);
   steps = psteps ? (*psteps) : 0x10;
   for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++)
     steps >>= 1;
   /* Select interface rate */
   host->speed = KW_I2C_MODE_25KHZ;
   prate = of_get_property(np, "AAPL,i2c-rate", NULL);
   if (prate) switch (*prate) {
     case 100: host->speed = KW_I2C_MODE_100KHZ; break;
     case 50: host->speed = KW_I2C_MODE_50KHZ; break;
     case 25: host->speed = KW_I2C_MODE_25KHZ; break;
     }
   host->irq = irq_of_parse_and_map(np, 0);
   if (!host->irq) printk(KERN_WARNING "low_i2c: Failed to map interrupt for %pOF\n", np);
   host->base = ioremap((*addrp), 0x1000);
   if (host->base == NULL) {
     printk(KERN_ERR "low_i2c: Can't map registers for %pOF\n", np);
     kfree(host);
     return NULL;
   }
   /* Make sure IRQ is disabled */
   kw_write_reg(reg_ier, 0);
   /* Request chip interrupt. We set IRQF_NO_SUSPEND because we don't
    * want that interrupt disabled between the 2 passes of driver
    * suspend or we'll have issues running the pfuncs
    */
   if (request_irq(host->irq, kw_i2c_irq, IRQF_NO_SUSPEND, "keywest i2c", host)) host->irq = 0;
   printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %pOF\n", *addrp, host->irq, np);
   return host;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,27 +1,27 @@
 static void *pmac_i2c_do_begin(struct pmf_function *func, struct pmf_args *args) {
   struct pmac_i2c_pf_inst *inst;
   struct pmac_i2c_bus *bus;
   bus = pmac_i2c_find_bus(func->node);
   if (bus == NULL) {
     printk(KERN_ERR "low_i2c: Can't find bus for %pOF (pfunc)\n", func->node);
     return NULL;
   }
   if (pmac_i2c_open(bus, 0)) {
     printk(KERN_ERR "low_i2c: Can't open i2c bus for %pOF (pfunc)\n", func->node);
     return NULL;
   }
   /* XXX might need GFP_ATOMIC when called during the suspend process,
    * but then, there are already lots of issues with suspending when
    * near OOM that need to be resolved, the allocator itself should
    * probably make GFP_NOIO implicit during suspend
    */
-  inst = kzalloc(sizeof(struct pmac_i2c_pf_inst), GFP_KERNEL);
+  inst = kzalloc(sizeof(*inst), GFP_KERNEL);
   if (inst == NULL) {
     pmac_i2c_close(bus);
     return NULL;
   }
   inst->bus = bus;
   inst->addr = pmac_i2c_get_dev_addr(func->node);
   inst->quirks = (int)(long)func->driver_data;
   return inst;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,81 +1,81 @@
 static int pmu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, u32 subaddr, u8 *data, int len) {
   struct adb_request *req = bus->hostdata;
   struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req->data[1];
   struct completion comp;
   int read = addrdir & 1;
   int retry;
   int rc = 0;
   /* For now, limit ourselves to 16 bytes transfers */
   if (len > 16) return -EINVAL;
   init_completion(&comp);
   for (retry = 0; retry < 16; retry++) {
-    memset(req, 0, sizeof(struct adb_request));
+    memset(req, 0, sizeof(*req));
     hdr->bus = bus->channel;
     hdr->count = len;
     switch (bus->mode) {
     case pmac_i2c_mode_std:
       if (subsize != 0) return -EINVAL;
       hdr->address = addrdir;
       hdr->mode = PMU_I2C_MODE_SIMPLE;
       break;
     case pmac_i2c_mode_stdsub:
     case pmac_i2c_mode_combined:
       if (subsize != 1) return -EINVAL;
       hdr->address = addrdir & 0xfe;
       hdr->comb_addr = addrdir;
       hdr->sub_addr = subaddr;
       if (bus->mode == pmac_i2c_mode_stdsub)
         hdr->mode = PMU_I2C_MODE_STDSUB;
       else
         hdr->mode = PMU_I2C_MODE_COMBINED;
       break;
     default: return -EINVAL;
     }
     reinit_completion(&comp);
     req->data[0] = PMU_I2C_CMD;
     req->reply[0] = 0xff;
     req->nbytes = sizeof(struct pmu_i2c_hdr) + 1;
     req->done = pmu_i2c_complete;
     req->arg = &comp;
     if (!read && len) {
       memcpy(hdr->data, data, len);
       req->nbytes += len;
     }
     rc = pmu_queue_request(req);
     if (rc) return rc;
     wait_for_completion(&comp);
     if (req->reply[0] == PMU_I2C_STATUS_OK) break;
     msleep(15);
   }
   if (req->reply[0] != PMU_I2C_STATUS_OK) return -EIO;
   for (retry = 0; retry < 16; retry++) {
-    memset(req, 0, sizeof(struct adb_request));
+    memset(req, 0, sizeof(*req));
     /* I know that looks like a lot, slow as hell, but darwin
      * does it so let's be on the safe side for now
      */
     msleep(15);
     hdr->bus = PMU_I2C_BUS_STATUS;
     reinit_completion(&comp);
     req->data[0] = PMU_I2C_CMD;
     req->reply[0] = 0xff;
     req->nbytes = 2;
     req->done = pmu_i2c_complete;
     req->arg = &comp;
     rc = pmu_queue_request(req);
     if (rc) return rc;
     wait_for_completion(&comp);
     if (req->reply[0] == PMU_I2C_STATUS_OK && !read) return 0;
     if (req->reply[0] == PMU_I2C_STATUS_DATAREAD && read) {
       int rlen = req->reply_len - 1;
       if (rlen != len) {
         printk(KERN_WARNING "low_i2c: PMU returned %d"
                             " bytes, expected %d !\n",
                rlen, len);
         return -EIO;
       }
       if (len) memcpy(data, &req->reply[1], len);
       return 0;
     }
   }
   return -EIO;
 }<sep>@@
type T,T1;
idexpression T *e;
expression f;
@@

f(...,(T1)e,...,sizeof(
- T
+ *e
 ),...)
--- initial
+++ final
@@ -1,39 +1,39 @@
 static int smu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, u32 subaddr, u8 *data, int len) {
   struct smu_i2c_cmd *cmd = bus->hostdata;
   struct completion comp;
   int read = addrdir & 1;
   int rc = 0;
   if ((read && len > SMU_I2C_READ_MAX) || ((!read) && len > SMU_I2C_WRITE_MAX)) return -EINVAL;
-  memset(cmd, 0, sizeof(struct smu_i2c_cmd));
+  memset(cmd, 0, sizeof(*cmd));
   cmd->info.bus = bus->channel;
   cmd->info.devaddr = addrdir;
   cmd->info.datalen = len;
   switch (bus->mode) {
   case pmac_i2c_mode_std:
     if (subsize != 0) return -EINVAL;
     cmd->info.type = SMU_I2C_TRANSFER_SIMPLE;
     break;
   case pmac_i2c_mode_stdsub:
   case pmac_i2c_mode_combined:
     if (subsize > 3 || subsize < 1) return -EINVAL;
     cmd->info.sublen = subsize;
     /* that's big-endian only but heh ! */
     memcpy(&cmd->info.subaddr, ((char *)&subaddr) + (4 - subsize), subsize);
     if (bus->mode == pmac_i2c_mode_stdsub)
       cmd->info.type = SMU_I2C_TRANSFER_STDSUB;
     else
       cmd->info.type = SMU_I2C_TRANSFER_COMBINED;
     break;
   default: return -EINVAL;
   }
   if (!read && len) memcpy(cmd->info.data, data, len);
   init_completion(&comp);
   cmd->done = smu_i2c_complete;
   cmd->misc = &comp;
   rc = smu_queue_i2c(cmd);
   if (rc < 0) return rc;
   wait_for_completion(&comp);
   rc = cmd->status;
   if (read && len) memcpy(data, cmd->info.data, len);
   return rc < 0 ? rc : 0;
 }<sep>@@
type T,T1;
idexpression T *e;
expression f;
@@

f(...,(T1)e,...,sizeof(
- T
+ *e
 ),...)
--- initial
+++ final
@@ -1,11 +1,11 @@
 int spu_alloc_lscsa(struct spu_state *csa) {
   struct spu_lscsa *lscsa;
   unsigned char *p;
-  lscsa = vzalloc(sizeof(struct spu_lscsa));
+  lscsa = vzalloc(sizeof(*lscsa));
   if (!lscsa) return -ENOMEM;
   csa->lscsa = lscsa;
   /* Set LS pages reserved to allow for user-space mapping. */
   for (p = lscsa->ls; p < lscsa->ls + LS_SIZE; p += PAGE_SIZE)
     SetPageReserved(vmalloc_to_page(p));
   return 0;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)
--- initial
+++ final
@@ -1,51 +1,51 @@
 static int dma_ioc0_map_pages(struct ps3_dma_region *r, unsigned long phys_addr, unsigned long len, struct dma_chunk **c_out, u64 iopte_flag) {
   int result;
   struct dma_chunk *c, *last;
   int iopage, pages;
   unsigned long offset;
   DBG(KERN_ERR "%s: phy=%#lx, lpar%#lx, len=%#lx\n", __func__, phys_addr, ps3_mm_phys_to_lpar(phys_addr), len);
-  c = kzalloc(sizeof(struct dma_chunk), GFP_ATOMIC);
+  c = kzalloc(sizeof(*c), GFP_ATOMIC);
   if (!c) {
     result = -ENOMEM;
     goto fail_alloc;
   }
   c->region = r;
   c->len = len;
   c->lpar_addr = ps3_mm_phys_to_lpar(phys_addr);
   /* allocate IO address */
   if (list_empty(&r->chunk_list.head)) {
     /* first one */
     c->bus_addr = r->bus_addr;
   } else {
     /* derive from last bus addr*/
     last = list_entry(r->chunk_list.head.next, struct dma_chunk, link);
     c->bus_addr = last->bus_addr + last->len;
     DBG("%s: last bus=%#lx, len=%#lx\n", __func__, last->bus_addr, last->len);
   }
   /* FIXME: check whether length exceeds region size */
   /* build ioptes for the area */
   pages = len >> r->page_size;
   DBG("%s: pgsize=%#x len=%#lx pages=%#x iopteflag=%#llx\n", __func__, r->page_size, r->len, pages, iopte_flag);
   for (iopage = 0; iopage < pages; iopage++) {
     offset = (1 << r->page_size) * iopage;
     result = lv1_put_iopte(0, c->bus_addr + offset, c->lpar_addr + offset, r->ioid, iopte_flag);
     if (result) {
       pr_warn("%s:%d: lv1_put_iopte failed: %s\n", __func__, __LINE__, ps3_result(result));
       goto fail_map;
     }
     DBG("%s: pg=%d bus=%#lx, lpar=%#lx, ioid=%#x\n", __func__, iopage, c->bus_addr + offset, c->lpar_addr + offset, r->ioid);
   }
   /* be sure that last allocated one is inserted at head */
   list_add(&c->link, &r->chunk_list.head);
   *c_out = c;
   DBG("%s: end\n", __func__);
   return 0;
 fail_map:
   for (iopage--; 0 <= iopage; iopage--) {
     lv1_put_iopte(0, c->bus_addr + offset, c->lpar_addr + offset, r->ioid, 0);
   }
   kfree(c);
 fail_alloc:
   *c_out = NULL;
   return result;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,28 +1,28 @@
 static int dma_sb_map_pages(struct ps3_dma_region *r, unsigned long phys_addr, unsigned long len, struct dma_chunk **c_out, u64 iopte_flag) {
   int result;
   struct dma_chunk *c;
-  c = kzalloc(sizeof(struct dma_chunk), GFP_ATOMIC);
+  c = kzalloc(sizeof(*c), GFP_ATOMIC);
   if (!c) {
     result = -ENOMEM;
     goto fail_alloc;
   }
   c->region = r;
   c->lpar_addr = ps3_mm_phys_to_lpar(phys_addr);
   c->bus_addr = dma_sb_lpar_to_bus(r, c->lpar_addr);
   c->len = len;
   BUG_ON(iopte_flag != 0xf800000000000000UL);
   result = lv1_map_device_dma_region(c->region->dev->bus_id, c->region->dev->dev_id, c->lpar_addr, c->bus_addr, c->len, iopte_flag);
   if (result) {
     DBG("%s:%d: lv1_map_device_dma_region failed: %s\n", __func__, __LINE__, ps3_result(result));
     goto fail_map;
   }
   list_add(&c->link, &r->chunk_list.head);
   *c_out = c;
   return 0;
 fail_map:
   kfree(c);
 fail_alloc:
   *c_out = NULL;
   DBG(" <- %s:%d\n", __func__, __LINE__);
   return result;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,36 +1,36 @@
 static int ppc4xx_msi_probe(struct platform_device *dev) {
   struct ppc4xx_msi *msi;
   struct resource res;
   int err = 0;
   struct pci_controller *phb;
   dev_dbg(&dev->dev, "PCIE-MSI: Setting up MSI support...\n");
-  msi = kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL);
+  msi = kzalloc(sizeof(*msi), GFP_KERNEL);
   if (!msi) {
     dev_err(&dev->dev, "No memory for MSI structure\n");
     return -ENOMEM;
   }
   dev->dev.platform_data = msi;
   /* Get MSI ranges */
   err = of_address_to_resource(dev->dev.of_node, 0, &res);
   if (err) {
     dev_err(&dev->dev, "%pOF resource error!\n", dev->dev.of_node);
     goto error_out;
   }
   msi_irqs = of_irq_count(dev->dev.of_node);
   if (!msi_irqs) return -ENODEV;
   if (ppc4xx_setup_pcieh_hw(dev, res, msi)) goto error_out;
   err = ppc4xx_msi_init_allocator(dev, msi);
   if (err) {
     dev_err(&dev->dev, "Error allocating MSI bitmap\n");
     goto error_out;
   }
   ppc4xx_msi = *msi;
   list_for_each_entry(phb, &hose_list, list_node) {
     phb->controller_ops.setup_msi_irqs = ppc4xx_setup_msi_irqs;
     phb->controller_ops.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;
   }
   return err;
 error_out:
   ppc4xx_of_msi_remove(dev);
   return err;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,25 +1,25 @@
 int nvram_read_partition(struct nvram_os_partition *part, char *buff, int length, unsigned int *err_type, unsigned int *error_log_cnt) {
   int rc;
   loff_t tmp_index;
   struct err_log_info info;
   if (part->index == -1) return -1;
   if (length > part->size) length = part->size;
   tmp_index = part->index;
   if (part->os_partition) {
-    rc = ppc_md.nvram_read((char *)&info, sizeof(struct err_log_info), &tmp_index);
+    rc = ppc_md.nvram_read((char *)&info, sizeof(info), &tmp_index);
     if (rc <= 0) {
       pr_err("%s: Failed nvram_read (%d)\n", __func__, rc);
       return rc;
     }
   }
   rc = ppc_md.nvram_read(buff, length, &tmp_index);
   if (rc <= 0) {
     pr_err("%s: Failed nvram_read (%d)\n", __func__, rc);
     return rc;
   }
   if (part->os_partition) {
     *error_log_cnt = be32_to_cpu(info.seq_num);
     *err_type = be32_to_cpu(info.error_type);
   }
   return 0;
 }<sep>@@
type T,T1;
idexpression T e;
expression f;
@@

f(...,(T1)&e,...,sizeof(
- T
+ e
 ),...)
--- initial
+++ final
@@ -1,61 +1,61 @@
 int __init nvram_scan_partitions(void) {
   loff_t cur_index = 0;
   struct nvram_header phead;
   struct nvram_partition *tmp_part;
   unsigned char c_sum;
   char *header;
   int total_size;
   int err;
   if (ppc_md.nvram_size == NULL || ppc_md.nvram_size() <= 0) return -ENODEV;
   total_size = ppc_md.nvram_size();
 
   header = kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL);
   if (!header) {
     printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n");
     return -ENOMEM;
   }
   while (cur_index < total_size) {
     err = ppc_md.nvram_read(header, NVRAM_HEADER_LEN, &cur_index);
     if (err != NVRAM_HEADER_LEN) {
       printk(KERN_ERR "nvram_scan_partitions: Error parsing "
                       "nvram partitions\n");
       goto out;
     }
     cur_index -= NVRAM_HEADER_LEN; /* nvram_read will advance us */
     memcpy(&phead, header, NVRAM_HEADER_LEN);
     phead.length = be16_to_cpu(phead.length);
     err = 0;
     c_sum = nvram_checksum(&phead);
     if (c_sum != phead.checksum) {
       printk(KERN_WARNING "WARNING: nvram partition checksum"
                           " was %02x, should be %02x!\n",
              phead.checksum, c_sum);
       printk(KERN_WARNING "Terminating nvram partition scan\n");
       goto out;
     }
     if (!phead.length) {
       printk(KERN_WARNING "WARNING: nvram corruption "
                           "detected: 0-length partition\n");
       goto out;
     }
-    tmp_part = kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
+    tmp_part = kmalloc(sizeof(*tmp_part), GFP_KERNEL);
     err = -ENOMEM;
     if (!tmp_part) {
       printk(KERN_ERR "nvram_scan_partitions: kmalloc failed\n");
       goto out;
     }
 
     memcpy(&tmp_part->header, &phead, NVRAM_HEADER_LEN);
     tmp_part->index = cur_index;
     list_add_tail(&tmp_part->partition, &nvram_partitions);
 
     cur_index += phead.length * NVRAM_BLOCK_LEN;
   }
   err = 0;
 #ifdef DEBUG_NVRAM
   nvram_print_partitions("NVRAM Partitions");
 #endif
 out:
   kfree(header);
   return err;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,21 +1,21 @@
 int nvram_write_os_partition(struct nvram_os_partition *part, char *buff, int length, unsigned int err_type, unsigned int error_log_cnt) {
   int rc;
   loff_t tmp_index;
   struct err_log_info info;
   if (part->index == -1) return -ESPIPE;
   if (length > part->size) length = part->size;
   info.error_type = cpu_to_be32(err_type);
   info.seq_num = cpu_to_be32(error_log_cnt);
   tmp_index = part->index;
-  rc = ppc_md.nvram_write((char *)&info, sizeof(struct err_log_info), &tmp_index);
+  rc = ppc_md.nvram_write((char *)&info, sizeof(info), &tmp_index);
   if (rc <= 0) {
     pr_err("%s: Failed nvram_write (%d)\n", __func__, rc);
     return rc;
   }
   rc = ppc_md.nvram_write(buff, length, &tmp_index);
   if (rc <= 0) {
     pr_err("%s: Failed nvram_write (%d)\n", __func__, rc);
     return rc;
   }
   return 0;
 }<sep>@@
type T,T1;
idexpression T e;
expression f;
@@

f(...,(T1)&e,...,sizeof(
- T
+ e
 ),...)
--- initial
+++ final
@@ -1,36 +1,36 @@
 void *ppc4xx_ocm_alloc(phys_addr_t *phys, int size, int align, int flags, const char *owner) {
   void __iomem *addr = NULL;
   unsigned long offset;
   struct ocm_info *ocm;
   struct ocm_region *ocm_reg;
   struct ocm_block *ocm_blk;
   int i;
   for (i = 0; i < ocm_count; i++) {
     ocm = ocm_get_node(i);
     if (!ocm || !ocm->ready) continue;
     if (flags == PPC4XX_OCM_NON_CACHED)
       ocm_reg = &ocm->nc;
     else
       ocm_reg = &ocm->c;
     if (!ocm_reg->virt) continue;
     if (align < ocm->alignment) align = ocm->alignment;
     offset = rh_alloc_align(ocm_reg->rh, size, align, NULL);
     if (IS_ERR_VALUE(offset)) continue;
-    ocm_blk = kzalloc(sizeof(struct ocm_block), GFP_KERNEL);
+    ocm_blk = kzalloc(sizeof(*ocm_blk), GFP_KERNEL);
     if (!ocm_blk) {
       printk(KERN_ERR "PPC4XX OCM: could not allocate ocm block");
       rh_free(ocm_reg->rh, offset);
       break;
     }
     *phys = ocm_reg->phys + offset;
     addr = ocm_reg->virt + offset;
     size = ALIGN(size, align);
     ocm_blk->addr = addr;
     ocm_blk->size = size;
     ocm_blk->owner = owner;
     list_add_tail(&ocm_blk->list, &ocm_reg->list);
     ocm_reg->memfree -= size;
     break;
   }
   return addr;
 }<sep>@@
type T;
idexpression T *e;
identifier f;
@@

e = f(...,sizeof(
- T
+ *e
 ),...)



@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,34 +1,34 @@
 static int alloc_image_buf(char *buffer, size_t count) {
   void *addr;
   int size;
   if (count < sizeof(struct image_header_t)) {
     pr_warn("FLASH: Invalid candidate image\n");
     return -EINVAL;
   }
-  memcpy(&image_header, (void *)buffer, sizeof(struct image_header_t));
+  memcpy(&image_header, (void *)buffer, sizeof(image_header));
   image_data.size = be32_to_cpu(image_header.size);
   pr_debug("FLASH: Candidate image size = %u\n", image_data.size);
   if (image_data.size > MAX_IMAGE_SIZE) {
     pr_warn("FLASH: Too large image\n");
     return -EINVAL;
   }
   if (image_data.size < VALIDATE_BUF_SIZE) {
     pr_warn("FLASH: Image is shorter than expected\n");
     return -EINVAL;
   }
   image_data.data = vzalloc(PAGE_ALIGN(image_data.size));
   if (!image_data.data) {
     pr_err("%s : Failed to allocate memory\n", __func__);
     return -ENOMEM;
   }
   /* Pin memory */
   addr = image_data.data;
   size = PAGE_ALIGN(image_data.size);
   while (size > 0) {
     SetPageReserved(vmalloc_to_page(addr));
     addr += PAGE_SIZE;
     size -= PAGE_SIZE;
   }
   image_data.status = IMAGE_LOADING;
   return 0;
 }<sep>@@
expression e1,e2;
type T;
@@

memcpy (&e1,e2,
- sizeof(T)
+ sizeof(e1)
  )