netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions
@ 2025-04-09  9:24 Sagi Maimon
  2025-04-09 10:09 ` Vadim Fedorenko
  2025-04-10 10:23 ` Paolo Abeni
  0 siblings, 2 replies; 4+ messages in thread
From: Sagi Maimon @ 2025-04-09  9:24 UTC (permalink / raw)
  To: jonathan.lemon, vadim.fedorenko, richardcochran, andrew+netdev,
	davem, edumazet, kuba, pabeni
  Cc: linux-kernel, netdev, Sagi Maimon

In __handle_signal_outputs and __handle_signal_inputs add
irig and dcf NULL-check

Signed-off-by: Sagi Maimon <maimon.sagi@gmail.com>
---
 drivers/ptp/ptp_ocp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index 7945c6be1f7c..4e4a6f465b01 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -2434,15 +2434,19 @@ ptp_ocp_dcf_in(struct ptp_ocp *bp, bool enable)
 static void
 __handle_signal_outputs(struct ptp_ocp *bp, u32 val)
 {
-	ptp_ocp_irig_out(bp, val & 0x00100010);
-	ptp_ocp_dcf_out(bp, val & 0x00200020);
+	if (bp->irig_out)
+		ptp_ocp_irig_out(bp, val & 0x00100010);
+	if (bp->dcf_out)
+		ptp_ocp_dcf_out(bp, val & 0x00200020);
 }
 
 static void
 __handle_signal_inputs(struct ptp_ocp *bp, u32 val)
 {
-	ptp_ocp_irig_in(bp, val & 0x00100010);
-	ptp_ocp_dcf_in(bp, val & 0x00200020);
+	if (bp->irig_out)
+		ptp_ocp_irig_in(bp, val & 0x00100010);
+	if (bp->dcf_out)
+		ptp_ocp_dcf_in(bp, val & 0x00200020);
 }
 
 static u32
-- 
2.45.2


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

* Re: [PATCH v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions
  2025-04-09  9:24 [PATCH v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions Sagi Maimon
@ 2025-04-09 10:09 ` Vadim Fedorenko
  2025-04-10 10:23 ` Paolo Abeni
  1 sibling, 0 replies; 4+ messages in thread
From: Vadim Fedorenko @ 2025-04-09 10:09 UTC (permalink / raw)
  To: Sagi Maimon, jonathan.lemon, richardcochran, andrew+netdev, davem,
	edumazet, kuba, pabeni
  Cc: linux-kernel, netdev

On 09/04/2025 10:24, Sagi Maimon wrote:
> In __handle_signal_outputs and __handle_signal_inputs add
> irig and dcf NULL-check
> 
> Signed-off-by: Sagi Maimon <maimon.sagi@gmail.com>

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>


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

* Re: [PATCH v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions
  2025-04-09  9:24 [PATCH v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions Sagi Maimon
  2025-04-09 10:09 ` Vadim Fedorenko
@ 2025-04-10 10:23 ` Paolo Abeni
  2025-04-13 13:44   ` Sagi Maimon
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Abeni @ 2025-04-10 10:23 UTC (permalink / raw)
  To: Sagi Maimon, jonathan.lemon, vadim.fedorenko, richardcochran,
	andrew+netdev, davem, edumazet, kuba
  Cc: linux-kernel, netdev

On 4/9/25 11:24 AM, Sagi Maimon wrote:
> In __handle_signal_outputs and __handle_signal_inputs add
> irig and dcf NULL-check

You need to expand a little the commit message. Is the NULL ptr
dereference actually possible? How? or this is just defensive programming?

If there is a real NULL ptr dereference this need a suitable Fixes tag.

And you should specify the target tree in the subj prefix.

You can retain the collected ack when resubmitting.

Thanks,

Paolo


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

* Re: [PATCH v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions
  2025-04-10 10:23 ` Paolo Abeni
@ 2025-04-13 13:44   ` Sagi Maimon
  0 siblings, 0 replies; 4+ messages in thread
From: Sagi Maimon @ 2025-04-13 13:44 UTC (permalink / raw)
  To: Paolo Abeni
  Cc: jonathan.lemon, vadim.fedorenko, richardcochran, andrew+netdev,
	davem, edumazet, kuba, linux-kernel, netdev

HI Paolo
Most of your notes are clear and will be fixed.
can you explain more regarding: "And you should specify the target
tree in the subj prefix"
Did you mean: net, net-next, Linux-nex?

On Thu, Apr 10, 2025 at 1:23 PM Paolo Abeni <pabeni@redhat.com> wrote:
>
> On 4/9/25 11:24 AM, Sagi Maimon wrote:
> > In __handle_signal_outputs and __handle_signal_inputs add
> > irig and dcf NULL-check
>
> You need to expand a little the commit message. Is the NULL ptr
> dereference actually possible? How? or this is just defensive programming?
>
> If there is a real NULL ptr dereference this need a suitable Fixes tag.
>
> And you should specify the target tree in the subj prefix.
>
> You can retain the collected ack when resubmitting.
>
> Thanks,
>
> Paolo
>

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

end of thread, other threads:[~2025-04-13 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-09  9:24 [PATCH v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions Sagi Maimon
2025-04-09 10:09 ` Vadim Fedorenko
2025-04-10 10:23 ` Paolo Abeni
2025-04-13 13:44   ` Sagi Maimon

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).