[linux-cifs-client] [PATCH] cifs: cleanup initialization of bytes_written
Suresh Jayaraman
sjayaraman at suse.de
Tue Mar 30 07:27:35 MDT 2010
On 03/30/2010 06:20 PM, Jeff Layton wrote:
> On Tue, 30 Mar 2010 18:09:21 +0530
> Suresh Jayaraman <sjayaraman at suse.de> wrote:
>>
>> I'll resend this patch if that seems a better approach.
>>
>
> I think it's generally better to not rely on the callers to get this
> right. You've patched them up now, but if someone adds new callers of
> these functions later then they also have to get this right. Coding
> defensively can help save you from those sorts of bugs.
Very valid. Coding defensively makes it less error-prone.
> Since the value should always be overwritten in these functions, it
> makes more sense to me to have those functions just zero it out
> unconditionally early on. If you think the callers should do this, then
> you probably want to add a comment to these functions to make it clear
> that the caller is responsible for initializing that variable.
>
Absolutely.
Thanks,
--
Suresh Jayaraman
More information about the linux-cifs-client
mailing list