Re: [bug report] IB/hfi1: Prevent NULL pointer deferences in caching code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Dan, we'll take care of it.

-Denny

On Wed, 2016-10-12 at 09:06 +0300, Dan Carpenter wrote:
> Hello Mitko Haralanov,
> 
> The patch f19bd643dbde: "IB/hfi1: Prevent NULL pointer deferences in
> caching code" from Apr 12, 2016, leads to the following static
> checker warning:
> 
> 	drivers/infiniband/hw/hfi1/user_sdma.c:1147 pin_vector_pages()
> 	warn: 'rb_node' isn't an ERR_PTR
> 
> drivers/infiniband/hw/hfi1/user_sdma.c
>   1135  static int pin_vector_pages(struct user_sdma_request *req,
>   1136                              struct user_sdma_iovec *iovec)
>   1137  {
>   1138          int ret = 0, pinned, npages, cleared;
>   1139          struct page **pages;
>   1140          struct hfi1_user_sdma_pkt_q *pq = req->pq;
>   1141          struct sdma_mmu_node *node = NULL;
>   1142          struct mmu_rb_node *rb_node;
>   1143  
>   1144          rb_node = hfi1_mmu_rb_extract(pq->handler,
>   1145                                        (unsigned long)iovec-
> >iov.iov_base,
>   1146                                        iovec->iov.iov_len);
>   1147          if (rb_node && !IS_ERR(rb_node))
>                                 ^^^^^^^^^^^^^^^
> 
> hfi1_mmu_rb_extract() never returns error pointers.  Plz delete.
> 
>   1148                  node = container_of(rb_node, struct
> sdma_mmu_node, rb);
>   1149          else
>   1150                  rb_node = NULL;
>   1151  
>   1152          if (!node) {
>   1153                  node = kzalloc(sizeof(*node), GFP_KERNEL);
>   1154                  if (!node)
>   1155                          return -ENOMEM;
>   1156  
>   1157                  node->rb.addr = (unsigned long)iovec-
> >iov.iov_base;
>   1158                  node->pq = pq;
>   1159                  atomic_set(&node->refcount, 0);
>   1160          }
> 
> regards,
> dan carpenter
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" 
> in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html��.n��������+%����;��w��{.n�����{���fk��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux