[Intel-wired-lan] [next-queue PATCH v3] fm10k: Avoid crashing the kernel

Allan, Bruce W bruce.w.allan at intel.com
Wed Mar 9 20:28:42 UTC 2016


> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On
> Behalf Of Bruce Allan
> Sent: Wednesday, March 09, 2016 12:26 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [next-queue PATCH v3] fm10k: Avoid crashing the
> kernel
> 
> Use BUILD_BUG_ON() instead of BUG_ON() where appropriate to get a
> compile
> error rather than crash the kernel.
> 
> Unfortunately, BUILD_BUG_ON() cannot be used to replace the second
> instance
> of BUG_ON() as it will generate a compiletime assert when the compiler flag
> -fsanitize=signed-integer-overflow is used (e.g. when UBSAN is enabled).
> Instead, put in additional checks to prevent buffer overflow from occuring
> and WARN if the code is ever mistakenly changed to get additional register
> values without also updating the value of FM10K_REGS_LEN_VSI.
> 
> Also, replace associated magic numbers with existing defined constants and
> correct an applicable comment.
> 
> Signed-off-by: Bruce Allan <bruce.w.allan at intel.com>
> ---
> v3: changes described in 2nd and 3rd paragraphs in updated description
>  drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c |   22 +++++++++++++-
> --------
>  1 file changed, 13 insertions(+), 9 deletions(-)

This version supersedes Jake's patch with the same title (which is really a v2
of the original one I sent) that is currently applied to next-queue/dev-queue.



More information about the Intel-wired-lan mailing list