linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: mlx5: Add driver for Mellanox Connect-IB adapters
@ 2013-07-10 10:54 Dan Carpenter
       [not found] ` <20130710105415.GA31232-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2013-07-10 10:54 UTC (permalink / raw)
  To: eli; +Cc: linux-rdma, linux-sparse

---
Side note: Sparse should warn about endian bugs but in linux-next
endian checking is disabled because we hit:

include/uapi/linux/swab.h:71:16: error: undefined identifier '__builtin_bswap64'
include/uapi/linux/swab.h:71:33: error: not a function <noident>

do_error() in Sparse disables warning messages.  I feel like we
shouldn't do that.

        /* Shut up warnings after an error */
        max_warnings = 0;
---

Hello Eli Cohen,

The patch e126ba97dba9: "mlx5: Add driver for Mellanox Connect-IB 
adapters" from Jul 7, 2013, has an endian related bug:

drivers/net/ethernet/mellanox/mlx5/core/main.c
   214          memset(&set_out, 0, sizeof(set_out));
   215          set_ctx->hca_cap.uar_page_sz = cpu_to_be16(PAGE_SHIFT - 12);
                         ^^^^^^^^^^^^^^^^^^^
This is defined in the header as be32 but we are saving a be16 to it.
My guess is the header is correct and the be16 is wrong.

   216          set_ctx->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_SET_HCA_CAP);
   217          err = mlx5_cmd_exec(dev, set_ctx, sizeof(*set_ctx),
   218                                   &set_out, sizeof(set_out));

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mlx5: Add driver for Mellanox Connect-IB adapters
       [not found] ` <20130710105415.GA31232-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
@ 2013-07-10 11:28   ` Or Gerlitz
  2013-07-10 20:16   ` Josh Triplett
  1 sibling, 0 replies; 3+ messages in thread
From: Or Gerlitz @ 2013-07-10 11:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: eli-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-sparse-u79uwXL29TY76Z2rM5mHXA, Fengguang Wu

On 10/07/2013 13:54, Dan Carpenter wrote:
> ---
> Side note: Sparse should warn about endian bugs but in linux-next
> endian checking is disabled because we hit:
>
> include/uapi/linux/swab.h:71:16: error: undefined identifier '__builtin_bswap64'
> include/uapi/linux/swab.h:71:33: error: not a function <noident>
>
> do_error() in Sparse disables warning messages.  I feel like we
> shouldn't do that.
>
>          /* Shut up warnings after an error */
>          max_warnings = 0;
> ---
>
> Hello Eli Cohen,
>
> The patch e126ba97dba9: "mlx5: Add driver for Mellanox Connect-IB
> adapters" from Jul 7, 2013, has an endian related bug:
>
> drivers/net/ethernet/mellanox/mlx5/core/main.c
>     214          memset(&set_out, 0, sizeof(set_out));
>     215          set_ctx->hca_cap.uar_page_sz = cpu_to_be16(PAGE_SHIFT - 12);
>                           ^^^^^^^^^^^^^^^^^^^
> This is defined in the header as be32 but we are saving a be16 to it.
> My guess is the header is correct and the be16 is wrong.
>
>     216          set_ctx->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_SET_HCA_CAP);
>     217          err = mlx5_cmd_exec(dev, set_ctx, sizeof(*set_ctx),
>     218                                   &set_out, sizeof(set_out));
>
> regards,
> dan carpenter
>

Dan, this sparse catch was reported earlier by Fengguang Wu 
<fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>, we have a fix, will send now

Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mlx5: Add driver for Mellanox Connect-IB adapters
       [not found] ` <20130710105415.GA31232-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
  2013-07-10 11:28   ` Or Gerlitz
@ 2013-07-10 20:16   ` Josh Triplett
  1 sibling, 0 replies; 3+ messages in thread
From: Josh Triplett @ 2013-07-10 20:16 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: eli-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-sparse-u79uwXL29TY76Z2rM5mHXA

On Wed, Jul 10, 2013 at 01:54:15PM +0300, Dan Carpenter wrote:
> ---
> Side note: Sparse should warn about endian bugs but in linux-next
> endian checking is disabled because we hit:
> 
> include/uapi/linux/swab.h:71:16: error: undefined identifier '__builtin_bswap64'
> include/uapi/linux/swab.h:71:33: error: not a function <noident>
> 
> do_error() in Sparse disables warning messages.  I feel like we
> shouldn't do that.

No, I think that's the correct behavior: sparse should only generate
*errors* rather than warnings when it hits something that prevents it
from handling some chunk of code, in which case we'd get a huge number
of spurious warnings if not suppressed.

In any case, current Sparse has __builtin_bswap64, so you shouldn't get
that error.

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-10 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-10 10:54 mlx5: Add driver for Mellanox Connect-IB adapters Dan Carpenter
     [not found] ` <20130710105415.GA31232-dZEljifmRObu9KfB+GxooP8+0UxHXcjY@public.gmane.org>
2013-07-10 11:28   ` Or Gerlitz
2013-07-10 20:16   ` Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).