[lkml]   [2017]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] net/packet: initialize val in packet_getsockopt()
From: Alexander Potapenko <>
Date: Tue, 18 Apr 2017 19:47:08 +0200

> In the case getsockopt() is called with PACKET_HDRLEN and zero length,
> |val| remains uninitialized and the syscall may behave differently
> depending on its value. This doesn't have security consequences (as the
> uninit bytes aren't copied back), but it's still cleaner to initialize
> |val|.
> This bug has been detected with KMSAN.
> Signed-off-by: Alexander Potapenko <>

Copying into an 'int' only 1, 2, or 3 bytes is not going to work

Either enforce that it must be 4 bytes long, or handle the smaller
sizes properly such that it will work regardless of endianness.


 \ /
  Last update: 2017-04-20 21:57    [W:0.035 / U:1.640 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site