From: Wolfgang Denk Date: Thu, 13 May 2004 17:56:42 +0200 Subject: [U-Boot-Users] [Patch] envcommon In-Reply-To: Your message of "Thu, 13 May 2004 16:37:24 +0200." <20040513143724.GP27774@pengutronix.de> Message-ID: <20040513155647.DCE9CC108D@atlas.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In message <20040513143724.GP27774@pengutronix.de> you wrote: > > * Patch by Kai-Uwe Bloem, Robert Schwebel, 13 May 2004: > Copy data only when we _have_ a default environment, > otherwhise set environment to 0. Why is this patch needed? > memset (env_ptr, 0, sizeof(env_t)); Here the environment gets zeroed. > - memcpy (env_ptr->data, > - default_environment, > - sizeof(default_environment)); > + if (sizeof(default_environment) > 0) > + memcpy (env_ptr->data, > + default_environment, > + sizeof(default_environment)); > + else > + env_ptr->data[0] = '\0'; For sizeof(default_environment)>0 your patch does not change anything; for sizeof(default_environment)==0 it adds the "env_ptr->data[0] = '\0'" statement which seems to be redundand to me since the whole area was zeroed out earlier. [And "memcpy(d,s,0)" is a noop, right?] Am I missing something? Best regards, Wolfgang Denk -- Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de You can love it, change it, or leave it. There is NO other option. But do not complain - it is your own choice... -- wd