From: Andrew Lunn <andrew@lunn•ch>
To: Piergiorgio Beruto <piergiorgio.beruto@gmail•com>
Cc: kuba@kernel•org, netdev@vger•kernel.org, peppe.cavallaro@st•com
Subject: Re: [PATCH net] stmmac: fix potential division by 0
Date: Thu, 1 Dec 2022 02:39:03 +0100 [thread overview]
Message-ID: <Y4gFt9GBRyv3kl2Y@lunn.ch> (raw)
In-Reply-To: <Y4f3NGAZ2rqHkjWV@gvm01>
On Thu, Dec 01, 2022 at 01:37:08AM +0100, Piergiorgio Beruto wrote:
> Depending on the HW platform and configuration, the
> stmmac_config_sub_second_increment() function may return 0 in the
> sec_inc variable. Therefore, the subsequent div_u64 operation can Oops
> the kernel because of the divisor being 0.
I'm wondering why it would return 0? Is the configuration actually
invalid? Is ptp_clock is too small, such that the value of data is
bigger than 255, but when masked with 0xff it gives zero?
I'm wondering if the correct thing to do is return -EINVAL in
stmmac_init_tstamp_counter().
So i would like an explanation of why it is zero.
Thanks
Andrew
next prev parent reply other threads:[~2022-12-01 1:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 0:37 [PATCH net] stmmac: fix potential division by 0 Piergiorgio Beruto
2022-12-01 1:39 ` Andrew Lunn [this message]
2022-12-01 10:24 ` Piergiorgio Beruto
2022-12-01 14:49 ` Andrew Lunn
2022-12-02 8:26 ` Piergiorgio Beruto
2022-12-07 2:28 ` Jakub Kicinski
2022-12-07 13:48 ` Andrew Lunn
2022-12-07 14:50 ` Kurt Kanzenbach
2022-12-08 0:26 ` Andrew Lunn
2022-12-08 9:27 ` Piergiorgio Beruto
2022-12-10 10:50 ` Andrew Lunn
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=Y4gFt9GBRyv3kl2Y@lunn.ch \
--to=andrew@lunn$(echo .)ch \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=peppe.cavallaro@st$(echo .)com \
--cc=piergiorgio.beruto@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox