diff mbox series

[v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions

Message ID 20250409092446.64202-1-maimon.sagi@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v1] ptp: ocp: add irig and dcf NULL-check in __handle_signal functions | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest warning net-next-2025-04-09--15-00 (tests: 900)

Commit Message

Sagi Maimon April 9, 2025, 9:24 a.m. UTC
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(-)

Comments

Vadim Fedorenko April 9, 2025, 10:09 a.m. UTC | #1
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>
Paolo Abeni April 10, 2025, 10:23 a.m. UTC | #2
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
Sagi Maimon April 13, 2025, 1:44 p.m. UTC | #3
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
>
diff mbox series

Patch

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