Showing error 794

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_verbs.c
Line in file: 1901
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:26:27 UTC


Source:

1871static int ipath_query_pkey(struct ib_device *ibdev, u8 port, u16 index,
1872                            u16 *pkey)
1873{
1874        struct ipath_ibdev *dev = to_idev(ibdev);
1875        int ret;
1876
1877        if (index >= ipath_get_npkeys(dev->dd)) {
1878                ret = -EINVAL;
1879                goto bail;
1880        }
1881
1882        *pkey = ipath_get_pkey(dev->dd, index);
1883        ret = 0;
1884
1885bail:
1886        return ret;
1887}
1888
1889/**
1890 * ipath_alloc_ucontext - allocate a ucontest
1891 * @ibdev: the infiniband device
1892 * @udata: not used by the InfiniPath driver
1893 */
1894
1895static struct ib_ucontext *ipath_alloc_ucontext(struct ib_device *ibdev,
1896                                                struct ib_udata *udata)
1897{
1898        struct ipath_ucontext *context;
1899        struct ib_ucontext *ret;
1900
1901        context = kmalloc(sizeof *context, GFP_KERNEL);
1902        if (!context) {
1903                ret = ERR_PTR(-ENOMEM);
1904                goto bail;
1905        }
1906
1907        ret = &context->ibucontext;
1908
1909bail:
1910        return ret;
1911}
Show full sources