Showing error 802

User: Jiri Slaby
Error type: Memory Leak
Error type description: There the code omits to free some allocated memory
File location: drivers/infiniband/hw/ipath/ipath_file_ops.c
Line in file: 1603
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:26:27 UTC


Source:

1573        struct ipath_portdata *pd;
1574        int ret;
1575
1576        if (!(pd = dd->ipath_pd[port])) {
1577                void *ptmp;
1578
1579                pd = kzalloc(sizeof(struct ipath_portdata), GFP_KERNEL);
1580
1581                /*
1582                 * Allocate memory for use in ipath_tid_update() just once
1583                 * at open, not per call.  Reduces cost of expected send
1584                 * setup.
1585                 */
1586                ptmp = kmalloc(dd->ipath_rcvtidcnt * sizeof(u16) +
1587                               dd->ipath_rcvtidcnt * sizeof(struct page **),
1588                               GFP_KERNEL);
1589                if (!pd || !ptmp) {
1590                        ipath_dev_err(dd, "Unable to allocate portdata "
1591                                      "memory, failing open\n");
1592                        ret = -ENOMEM;
1593                        kfree(pd);
1594                        kfree(ptmp);
1595                        goto bail;
1596                }
1597                dd->ipath_pd[port] = pd;
1598                dd->ipath_pd[port]->port_port = port;
1599                dd->ipath_pd[port]->port_dd = dd;
1600                dd->ipath_pd[port]->port_tid_pg_list = ptmp;
1601                init_waitqueue_head(&dd->ipath_pd[port]->port_wait);
1602        }
1603        if (!pd->port_cnt) {
1604                pd->userversion = uinfo->spu_userversion;
1605                init_user_egr_sizes(pd);
1606                if ((ret = init_subports(dd, pd, uinfo)) != 0)
1607                        goto bail;
1608                ipath_cdbg(PROC, "%s[%u] opened unit:port %u:%u\n",
1609                           current->comm, current->pid, dd->ipath_unit,
1610                           port);
1611                pd->port_cnt = 1;
1612                port_fp(fp) = pd;
1613                pd->port_pid = get_pid(task_pid(current));
Show full sources