Re: [PATCH net v3] ptp: Add a upper bound on max_vclocks

From: Jakub Kicinski

Date: Fri Sep 26 2025 - 18:30:22 EST


On Thu, 25 Sep 2025 21:29:08 +0530 I Viswanath wrote:
> This can be reproduced by executing:
>
> echo x > /sys/devices/virtual/ptp/ptp0/max_vclocks
>
> where x > KMALLOC_MAX_SIZE/(sizeof(int)) which computes to 1048576 on
> my system
>
> What would be a reasonable value for PTP_MAX_VCLOCKS_LIMIT?

I wonder about that, too. Perhaps tying uAPI behavior to
KMALLOC_MAX_SIZE is going to come back to bite us. But I don't
have a great idea for what the max should be.

> KMALLOC_MAX_SIZE/(sizeof(int)) is the absolute max value for which the
> memory allocation won't fail