Message ID | 20211122100706.2775865-1-dominique.martinet@atmark-techno.com |
---|---|
State | Superseded |
Headers | show |
Series | None | expand |
On Mon, Nov 22, 2021 at 3:07 AM Dominique Martinet <dominique.martinet@atmark-techno.com> wrote: > > ipcmsg.data.msg is a small part of the union (128 bytes of 2048+), > so the send_notify_msg below sends uninitalized bytes over the socket. > > These are normally not accessed so it is not an important fix, but > might as well fix valgrind warnings > > Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> > --- > This is 100% unrelated, I should probably have sent separately but ran > out of time today, sorry -- feel free to ignore this one if you're not > interested. > > core/network_thread.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/core/network_thread.c b/core/network_thread.c > index c16775d37763..4dd3ec27ae8f 100644 > --- a/core/network_thread.c > +++ b/core/network_thread.c > @@ -207,7 +207,7 @@ static void network_notifier(RECOVERY_STATUS status, int error, int level, const > > ipcmsg.magic = IPC_MAGIC; > ipcmsg.type = NOTIFY_STREAM; > - memset(ipcmsg.data.msg, 0, sizeof(ipcmsg.data.msg)); > + memset(&ipcmsg.data, 0, sizeof(ipcmsg.data)); This looks like it's a duplicate of: https://github.com/sbabic/swupdate/commit/38372f3e0eb9186cb39ce0f4072c078addc18643 > > strncpy(ipcmsg.data.notify.msg, newmsg->msg, > sizeof(ipcmsg.data.notify.msg) - 1); > -- > 2.30.2 > > -- > You received this message because you are subscribed to the Google Groups "swupdate" group. > To unsubscribe from this group and stop receiving emails from it, send an email to swupdate+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/swupdate/20211122100706.2775865-1-dominique.martinet%40atmark-techno.com.
James Hilliard wrote on Mon, Nov 22, 2021 at 03:09:26AM -0700: > > ipcmsg.magic = IPC_MAGIC; > > ipcmsg.type = NOTIFY_STREAM; > > - memset(ipcmsg.data.msg, 0, sizeof(ipcmsg.data.msg)); > > + memset(&ipcmsg.data, 0, sizeof(ipcmsg.data)); > > This looks like it's a duplicate of: > https://github.com/sbabic/swupdate/commit/38372f3e0eb9186cb39ce0f4072c078addc18643 Right, nothing goes well when one hurries... Thanks for noticing! :)
diff --git a/core/network_thread.c b/core/network_thread.c index c16775d37763..4dd3ec27ae8f 100644 --- a/core/network_thread.c +++ b/core/network_thread.c @@ -207,7 +207,7 @@ static void network_notifier(RECOVERY_STATUS status, int error, int level, const ipcmsg.magic = IPC_MAGIC; ipcmsg.type = NOTIFY_STREAM; - memset(ipcmsg.data.msg, 0, sizeof(ipcmsg.data.msg)); + memset(&ipcmsg.data, 0, sizeof(ipcmsg.data)); strncpy(ipcmsg.data.notify.msg, newmsg->msg, sizeof(ipcmsg.data.notify.msg) - 1);
ipcmsg.data.msg is a small part of the union (128 bytes of 2048+), so the send_notify_msg below sends uninitalized bytes over the socket. These are normally not accessed so it is not an important fix, but might as well fix valgrind warnings Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> --- This is 100% unrelated, I should probably have sent separately but ran out of time today, sorry -- feel free to ignore this one if you're not interested. core/network_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)