* [edk2-devel] [edk2-libc Patch v2 0/1] edk2-libc:Fix uninitialized global variable @ 2023-07-26 15:38 Jayaprakash, N 2023-07-26 15:38 ` [edk2-devel] [edk2-libc Patch v2 1/1] edk2-libc/StdLib: Fix " Jayaprakash, N [not found] ` <1775750E87670E14.27380@groups.io> 0 siblings, 2 replies; 3+ messages in thread From: Jayaprakash, N @ 2023-07-26 15:38 UTC (permalink / raw) To: devel; +Cc: Jayaprakash N This patch contains a fix for the uninitialized global variable in edk2-libc/StdLib/BsdSocketLib/res_init.c Jayaprakash N (1): edk2-libc/StdLib: Fix uninitialized global variable StdLib/BsdSocketLib/res_init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.40.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107272): https://edk2.groups.io/g/devel/message/107272 Mute This Topic: https://groups.io/mt/100373037/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 3+ messages in thread
* [edk2-devel] [edk2-libc Patch v2 1/1] edk2-libc/StdLib: Fix uninitialized global variable 2023-07-26 15:38 [edk2-devel] [edk2-libc Patch v2 0/1] edk2-libc:Fix uninitialized global variable Jayaprakash, N @ 2023-07-26 15:38 ` Jayaprakash, N [not found] ` <1775750E87670E14.27380@groups.io> 1 sibling, 0 replies; 3+ messages in thread From: Jayaprakash, N @ 2023-07-26 15:38 UTC (permalink / raw) To: devel; +Cc: Jayaprakash N, Rebecca Cran, Michael D Kinney, Kloper Dimitry REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4506 res_init() is called from different places in sockets library. It depends on global _res variable containing a state. The problem is that if __BIND_RES_TEXT macro is not defined, _res is not initialized. Depending on compiler and build optimization this can fill the variable with garbage that is later used by res_init(). Fix is trivial - explicitly initialize _res. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Jayaprakash N <n.jayaprakash@intel.com> Signed-off-by: Kloper Dimitry <dimitry.kloper@intel.com> --- StdLib/BsdSocketLib/res_init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/StdLib/BsdSocketLib/res_init.c b/StdLib/BsdSocketLib/res_init.c index 613a76a..9df7d4f 100644 --- a/StdLib/BsdSocketLib/res_init.c +++ b/StdLib/BsdSocketLib/res_init.c @@ -121,9 +121,11 @@ static u_int32_t net_mask __P((struct in_addr)); */ struct __res_state _res -# if defined(__BIND_RES_TEXT) +#if defined(__BIND_RES_TEXT) = { RES_TIMEOUT, } /* Motorola, et al. */ -# endif +#else + = {0} +#endif ; -- 2.40.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107273): https://edk2.groups.io/g/devel/message/107273 Mute This Topic: https://groups.io/mt/100373041/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1775750E87670E14.27380@groups.io>]
* Re: [edk2-devel] [edk2-libc Patch v2 1/1] edk2-libc/StdLib: Fix uninitialized global variable [not found] ` <1775750E87670E14.27380@groups.io> @ 2023-07-31 5:45 ` Jayaprakash, N 0 siblings, 0 replies; 3+ messages in thread From: Jayaprakash, N @ 2023-07-31 5:45 UTC (permalink / raw) To: devel@edk2.groups.io, Jayaprakash, N Cc: Rebecca Cran, Kinney, Michael D, Kloper, Dimitry Reviewed-by: Jayaprakash N <n.jayaprakash@intel.com> Regards, JP -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jayaprakash, N Sent: Wednesday, July 26, 2023 9:09 PM To: devel@edk2.groups.io Cc: Jayaprakash, N <n.jayaprakash@intel.com>; Rebecca Cran <rebecca@bsdio.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Kloper, Dimitry <dimitry.kloper@intel.com> Subject: [edk2-devel] [edk2-libc Patch v2 1/1] edk2-libc/StdLib: Fix uninitialized global variable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4506 res_init() is called from different places in sockets library. It depends on global _res variable containing a state. The problem is that if __BIND_RES_TEXT macro is not defined, _res is not initialized. Depending on compiler and build optimization this can fill the variable with garbage that is later used by res_init(). Fix is trivial - explicitly initialize _res. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Jayaprakash N <n.jayaprakash@intel.com> Signed-off-by: Kloper Dimitry <dimitry.kloper@intel.com> --- StdLib/BsdSocketLib/res_init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/StdLib/BsdSocketLib/res_init.c b/StdLib/BsdSocketLib/res_init.c index 613a76a..9df7d4f 100644 --- a/StdLib/BsdSocketLib/res_init.c +++ b/StdLib/BsdSocketLib/res_init.c @@ -121,9 +121,11 @@ static u_int32_t net_mask __P((struct in_addr)); */ struct __res_state _res -# if defined(__BIND_RES_TEXT) +#if defined(__BIND_RES_TEXT) = { RES_TIMEOUT, } /* Motorola, et al. */ -# endif +#else + = {0} +#endif ; -- 2.40.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107394): https://edk2.groups.io/g/devel/message/107394 Mute This Topic: https://groups.io/mt/100456378/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-31 5:45 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-07-26 15:38 [edk2-devel] [edk2-libc Patch v2 0/1] edk2-libc:Fix uninitialized global variable Jayaprakash, N 2023-07-26 15:38 ` [edk2-devel] [edk2-libc Patch v2 1/1] edk2-libc/StdLib: Fix " Jayaprakash, N [not found] ` <1775750E87670E14.27380@groups.io> 2023-07-31 5:45 ` Jayaprakash, N
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox