Re: [PATCH] cifs: cleanup initialization of bytes_written

Suresh Jayaraman <[email protected]>
Newsgroups gmane.linux.file-systems.cifs
Message-ID <[email protected]>
On 03/30/2010 06:20 PM, Jeff Layton wrote:
> On Tue, 30 Mar 2010 18:09:21 +0530
> Suresh Jayaraman <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.