All of lore.kernel.org
 help / color / mirror / Atom feed
* question about fs/jffs2/readinode.c
@ 2012-04-28  5:06 Julia Lawall
  2012-05-02 12:07   ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2012-04-28  5:06 UTC (permalink / raw)
  To: dwmw2; +Cc: linux-mtd, linux-kernel

The function read_direntry in fs/jffs2/readinode.c contains the following 
code:

         err = jffs2_flash_read(c, (ref_offset(ref)) + read,
                                rd->nsize - already, &read, &fd->name[already]);
 	if (unlikely(read != rd->nsize - already) && likely(!err))
                       return -EIO;

         if (unlikely(err)) {
                 JFFS2_ERROR("read remainder of name: error %d\n", err);
                 jffs2_free_full_dirent(fd);
                 return -EIO;
         }

Is it intentional that the first if doesn't free fd?  At first I thought 
that that might be the case, because what would be the point of having two 
conditionals if they are going to do the same thing.  But I can't see why 
fd should not be freed either, so maybe the two conditionals are just 
there to give different error messages?

thanks,
julia

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about fs/jffs2/readinode.c
  2012-04-28  5:06 question about fs/jffs2/readinode.c Julia Lawall
@ 2012-05-02 12:07   ` Artem Bityutskiy
  0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2012-05-02 12:07 UTC (permalink / raw)
  To: Julia Lawall; +Cc: dwmw2, linux-mtd, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

On Sat, 2012-04-28 at 07:06 +0200, Julia Lawall wrote:
> The function read_direntry in fs/jffs2/readinode.c contains the following 
> code:
> 
>          err = jffs2_flash_read(c, (ref_offset(ref)) + read,
>                                 rd->nsize - already, &read, &fd->name[already]);
>  	if (unlikely(read != rd->nsize - already) && likely(!err))
>                        return -EIO;
> 
>          if (unlikely(err)) {
>                  JFFS2_ERROR("read remainder of name: error %d\n", err);
>                  jffs2_free_full_dirent(fd);
>                  return -EIO;
>          }
> 
> Is it intentional that the first if doesn't free fd?  At first I thought 
> that that might be the case, because what would be the point of having two 
> conditionals if they are going to do the same thing.  But I can't see why 
> fd should not be freed either, so maybe the two conditionals are just 
> there to give different error messages?

Hi Julia,

I think this is a bug and thes conditionals can be joined into one.

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about fs/jffs2/readinode.c
@ 2012-05-02 12:07   ` Artem Bityutskiy
  0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2012-05-02 12:07 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-mtd, dwmw2, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

On Sat, 2012-04-28 at 07:06 +0200, Julia Lawall wrote:
> The function read_direntry in fs/jffs2/readinode.c contains the following 
> code:
> 
>          err = jffs2_flash_read(c, (ref_offset(ref)) + read,
>                                 rd->nsize - already, &read, &fd->name[already]);
>  	if (unlikely(read != rd->nsize - already) && likely(!err))
>                        return -EIO;
> 
>          if (unlikely(err)) {
>                  JFFS2_ERROR("read remainder of name: error %d\n", err);
>                  jffs2_free_full_dirent(fd);
>                  return -EIO;
>          }
> 
> Is it intentional that the first if doesn't free fd?  At first I thought 
> that that might be the case, because what would be the point of having two 
> conditionals if they are going to do the same thing.  But I can't see why 
> fd should not be freed either, so maybe the two conditionals are just 
> there to give different error messages?

Hi Julia,

I think this is a bug and thes conditionals can be joined into one.

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about fs/jffs2/readinode.c
  2012-05-02 12:07   ` Artem Bityutskiy
@ 2012-05-02 12:27     ` Julia Lawall
  -1 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2012-05-02 12:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Julia Lawall, dwmw2, linux-mtd, linux-kernel

On Wed, 2 May 2012, Artem Bityutskiy wrote:

> On Sat, 2012-04-28 at 07:06 +0200, Julia Lawall wrote:
>> The function read_direntry in fs/jffs2/readinode.c contains the following
>> code:
>>
>>          err = jffs2_flash_read(c, (ref_offset(ref)) + read,
>>                                 rd->nsize - already, &read, &fd->name[already]);
>>  	if (unlikely(read != rd->nsize - already) && likely(!err))
>>                        return -EIO;
>>
>>          if (unlikely(err)) {
>>                  JFFS2_ERROR("read remainder of name: error %d\n", err);
>>                  jffs2_free_full_dirent(fd);
>>                  return -EIO;
>>          }
>>
>> Is it intentional that the first if doesn't free fd?  At first I thought
>> that that might be the case, because what would be the point of having two
>> conditionals if they are going to do the same thing.  But I can't see why
>> fd should not be freed either, so maybe the two conditionals are just
>> there to give different error messages?
>
> Hi Julia,
>
> I think this is a bug and thes conditionals can be joined into one.

Thanks!  I will send a patch soon.

julia

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: question about fs/jffs2/readinode.c
@ 2012-05-02 12:27     ` Julia Lawall
  0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2012-05-02 12:27 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Julia Lawall, dwmw2, linux-kernel, linux-mtd

On Wed, 2 May 2012, Artem Bityutskiy wrote:

> On Sat, 2012-04-28 at 07:06 +0200, Julia Lawall wrote:
>> The function read_direntry in fs/jffs2/readinode.c contains the following
>> code:
>>
>>          err = jffs2_flash_read(c, (ref_offset(ref)) + read,
>>                                 rd->nsize - already, &read, &fd->name[already]);
>>  	if (unlikely(read != rd->nsize - already) && likely(!err))
>>                        return -EIO;
>>
>>          if (unlikely(err)) {
>>                  JFFS2_ERROR("read remainder of name: error %d\n", err);
>>                  jffs2_free_full_dirent(fd);
>>                  return -EIO;
>>          }
>>
>> Is it intentional that the first if doesn't free fd?  At first I thought
>> that that might be the case, because what would be the point of having two
>> conditionals if they are going to do the same thing.  But I can't see why
>> fd should not be freed either, so maybe the two conditionals are just
>> there to give different error messages?
>
> Hi Julia,
>
> I think this is a bug and thes conditionals can be joined into one.

Thanks!  I will send a patch soon.

julia

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-02 12:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-28  5:06 question about fs/jffs2/readinode.c Julia Lawall
2012-05-02 12:07 ` Artem Bityutskiy
2012-05-02 12:07   ` Artem Bityutskiy
2012-05-02 12:27   ` Julia Lawall
2012-05-02 12:27     ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.