All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kalle Valo <kvalo@kernel.org>
Cc: Francesco Magliocca <franciman12@gmail.com>,
	Jeff Johnson <quic_jjohnson@quicinc.com>,
	ath10k@lists.infradead.org, rmanohar@qti.qualcomm.com,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2] ath10k: fix pointer arithmetic error in trace call
Date: Thu, 24 Feb 2022 10:53:46 +0300	[thread overview]
Message-ID: <20220224075346.GL3943@kadam> (raw)
In-Reply-To: <87o82wvhtk.fsf@kernel.org>

On Thu, Feb 24, 2022 at 09:34:31AM +0200, Kalle Valo wrote:
> Francesco Magliocca <franciman12@gmail.com> writes:
> 
> > Hi, I picked (void*) to be conformant with the other examples in htt_rx.c
> > For example at line 1431:
> >>    rxd = HTT_RX_BUF_TO_RX_DESC(hw,
> >>                    (void *)msdu->data - hw->rx_desc_ops->rx_desc_size);
> >
> > But for me it is ok. Maybe we should fix all the occurrences of this kind.
> 
> Yeah, it would be good to fix the void pointer arithmetic in a separate
> patch. I have planning to enable -Wpointer-arith in my ath10k-check and
> ath11k-check scripts, so patches are very welcome.

Void * casts simplify a lot of code.  Less noise.  More readable.
They're more accurate in a sense because it's not a u8 at all.  The
kernel can't compile with other compilers besides GCC and Clang so why
care about that the C standard hasn't caught up?

What does -Wpointer-arith buy us?

regards,
dan carpenter


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kalle Valo <kvalo@kernel.org>
Cc: Francesco Magliocca <franciman12@gmail.com>,
	Jeff Johnson <quic_jjohnson@quicinc.com>,
	ath10k@lists.infradead.org, rmanohar@qti.qualcomm.com,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2] ath10k: fix pointer arithmetic error in trace call
Date: Thu, 24 Feb 2022 10:53:46 +0300	[thread overview]
Message-ID: <20220224075346.GL3943@kadam> (raw)
In-Reply-To: <87o82wvhtk.fsf@kernel.org>

On Thu, Feb 24, 2022 at 09:34:31AM +0200, Kalle Valo wrote:
> Francesco Magliocca <franciman12@gmail.com> writes:
> 
> > Hi, I picked (void*) to be conformant with the other examples in htt_rx.c
> > For example at line 1431:
> >>    rxd = HTT_RX_BUF_TO_RX_DESC(hw,
> >>                    (void *)msdu->data - hw->rx_desc_ops->rx_desc_size);
> >
> > But for me it is ok. Maybe we should fix all the occurrences of this kind.
> 
> Yeah, it would be good to fix the void pointer arithmetic in a separate
> patch. I have planning to enable -Wpointer-arith in my ath10k-check and
> ath11k-check scripts, so patches are very welcome.

Void * casts simplify a lot of code.  Less noise.  More readable.
They're more accurate in a sense because it's not a u8 at all.  The
kernel can't compile with other compilers besides GCC and Clang so why
care about that the C standard hasn't caught up?

What does -Wpointer-arith buy us?

regards,
dan carpenter


  reply	other threads:[~2022-02-24  7:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 12:26 [PATCH v2] ath10k: fix pointer arithmetic error in trace call Francesco Magliocca
2022-02-21 12:26 ` Francesco Magliocca
2022-02-22 20:52 ` Jeff Johnson
2022-02-22 20:52   ` Jeff Johnson
2022-02-23 11:48   ` Francesco Magliocca
2022-02-23 11:48     ` Francesco Magliocca
2022-02-24  7:34     ` Kalle Valo
2022-02-24  7:34       ` Kalle Valo
2022-02-24  7:53       ` Dan Carpenter [this message]
2022-02-24  7:53         ` Dan Carpenter
2022-02-24  9:59         ` Use of void pointer arithmetic? Kalle Valo
2022-02-24  9:59           ` Kalle Valo
2022-02-24 10:31           ` Johannes Berg
2022-02-24 10:31             ` Johannes Berg
2022-02-24 17:45           ` Linus Torvalds
2022-02-24 17:45             ` Linus Torvalds
2022-02-24  9:05 ` [PATCH v2] ath10k: fix pointer arithmetic error in trace call Kalle Valo
2022-02-24  9:05   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220224075346.GL3943@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=ath10k@lists.infradead.org \
    --cc=franciman12@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_jjohnson@quicinc.com \
    --cc=rmanohar@qti.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.