diff mbox series

progress_ipc: Use correct read size inside receive function

Message ID 1508405044-17051-1-git-send-email-stefan.herbrechtsmeier@weidmueller.com
State Accepted
Headers show
Series progress_ipc: Use correct read size inside receive function | expand

Commit Message

Herbrechtsmeier Dr.-Ing. , Stefan Oct. 19, 2017, 9:24 a.m. UTC
The progress_ipc_receive function wrongly read a message with the
pointer size and not the struct size.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---
 ipc/progress_ipc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.7.4

Comments

Stefano Babic Oct. 19, 2017, 10:06 a.m. UTC | #1
On 19/10/2017 11:24, Stefan Herbrechtsmeier wrote:
> The progress_ipc_receive function wrongly read a message with the
> pointer size and not the struct size.
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> ---
>  ipc/progress_ipc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ipc/progress_ipc.c b/ipc/progress_ipc.c
> index 324f94e..ab50b1c 100644
> --- a/ipc/progress_ipc.c
> +++ b/ipc/progress_ipc.c
> @@ -60,8 +60,8 @@ int progress_ipc_connect(bool reconnect)
>  }
> 
>  int progress_ipc_receive(int *connfd, struct progress_msg *msg) {
> -       int ret = read(*connfd, msg, sizeof(msg));
> -       if (ret != sizeof(msg)) {
> +       int ret = read(*connfd, msg, sizeof(*msg));
> +       if (ret != sizeof(*msg)) {
>                 fprintf(stdout, "Connection closing..\n");
>                 close(*connfd);
>                 *connfd = -1;
> --
> 2.7.4
> 

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Stefano Babic Oct. 19, 2017, 2:25 p.m. UTC | #2
Hi Stefan,

On 19/10/2017 11:24, Stefan Herbrechtsmeier wrote:
> The progress_ipc_receive function wrongly read a message with the
> pointer size and not the struct size.
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> ---
>  ipc/progress_ipc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ipc/progress_ipc.c b/ipc/progress_ipc.c
> index 324f94e..ab50b1c 100644
> --- a/ipc/progress_ipc.c
> +++ b/ipc/progress_ipc.c
> @@ -60,8 +60,8 @@ int progress_ipc_connect(bool reconnect)
>  }
> 
>  int progress_ipc_receive(int *connfd, struct progress_msg *msg) {
> -       int ret = read(*connfd, msg, sizeof(msg));
> -       if (ret != sizeof(msg)) {
> +       int ret = read(*connfd, msg, sizeof(*msg));
> +       if (ret != sizeof(*msg)) {
>                 fprintf(stdout, "Connection closing..\n");
>                 close(*connfd);
>                 *connfd = -1;
> --
> 2.7.4
I applied the patch, but I cannot apply it as it is via git-am. I
suppose isues with your mailer, git-am reports that cannot be applied -
even if it looks apparently correct. So I did on my own. Can you check
it for future ?

Also your previous patchset looks strange. I do not see all patches in
patchwork, just the first two (that I will apply, anyway).
See:

	
	http://patchwork.ozlabs.org/project/swupdate/list/

Best regards,
Stefano Babic
Herbrechtsmeier Dr.-Ing. , Stefan Oct. 20, 2017, 7:40 a.m. UTC | #3
Hi Stefano,

> -----Ursprüngliche Nachricht-----
> Von: Stefano Babic [mailto:sbabic@denx.de]
> Gesendet: Donnerstag, 19. Oktober 2017 16:26
> An: Herbrechtsmeier Dr.-Ing. , Stefan; swupdate@googlegroups.com
> Betreff: Re: [swupdate] [PATCH] progress_ipc: Use correct read size
> inside receive function
>
> On 19/10/2017 11:24, Stefan Herbrechtsmeier wrote:
> > The progress_ipc_receive function wrongly read a message with the
> > pointer size and not the struct size.
> >
> > Signed-off-by: Stefan Herbrechtsmeier
> > <stefan.herbrechtsmeier@weidmueller.com>
> > ---
> >  ipc/progress_ipc.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/ipc/progress_ipc.c b/ipc/progress_ipc.c index
> > 324f94e..ab50b1c 100644
> > --- a/ipc/progress_ipc.c
> > +++ b/ipc/progress_ipc.c
> > @@ -60,8 +60,8 @@ int progress_ipc_connect(bool reconnect)  }
> >
> >  int progress_ipc_receive(int *connfd, struct progress_msg *msg) {
> > -       int ret = read(*connfd, msg, sizeof(msg));
> > -       if (ret != sizeof(msg)) {
> > +       int ret = read(*connfd, msg, sizeof(*msg));
> > +       if (ret != sizeof(*msg)) {
> >                 fprintf(stdout, "Connection closing..\n");
> >                 close(*connfd);
> >                 *connfd = -1;
> > --
> > 2.7.4
> I applied the patch, but I cannot apply it as it is via git-am. I
> suppose isues with your mailer, git-am reports that cannot be applied -
> even if it looks apparently correct. So I did on my own. Can you check
> it for future ?

I use git send-email. The patch doesn't work because the tabs are replaced by spaces.

The email I received use tabs but all other emails use spaces. I don't know why.

> > Also your previous patchset looks strange. I do not see all patches in
> patchwork, just the first two (that I will apply, anyway).

I use git send-email and all mails reached the mailing list.

Best regards

Stefan Herbrechtsmeier
Software Developer Embedded Systems

Let’s connect.
Stefano Babic Oct. 20, 2017, 8:05 a.m. UTC | #4
Hi Stefan,

On 20/10/2017 09:40, Stefan.Herbrechtsmeier@weidmueller.com wrote:
> Hi Stefano,
> 
>> -----Ursprüngliche Nachricht-----
>> Von: Stefano Babic [mailto:sbabic@denx.de]
>> Gesendet: Donnerstag, 19. Oktober 2017 16:26
>> An: Herbrechtsmeier Dr.-Ing. , Stefan; swupdate@googlegroups.com
>> Betreff: Re: [swupdate] [PATCH] progress_ipc: Use correct read size
>> inside receive function
>>
>> On 19/10/2017 11:24, Stefan Herbrechtsmeier wrote:
>>> The progress_ipc_receive function wrongly read a message with the
>>> pointer size and not the struct size.
>>>
>>> Signed-off-by: Stefan Herbrechtsmeier
>>> <stefan.herbrechtsmeier@weidmueller.com>
>>> ---
>>>  ipc/progress_ipc.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/ipc/progress_ipc.c b/ipc/progress_ipc.c index
>>> 324f94e..ab50b1c 100644
>>> --- a/ipc/progress_ipc.c
>>> +++ b/ipc/progress_ipc.c
>>> @@ -60,8 +60,8 @@ int progress_ipc_connect(bool reconnect)  }
>>>
>>>  int progress_ipc_receive(int *connfd, struct progress_msg *msg) {
>>> -       int ret = read(*connfd, msg, sizeof(msg));
>>> -       if (ret != sizeof(msg)) {
>>> +       int ret = read(*connfd, msg, sizeof(*msg));
>>> +       if (ret != sizeof(*msg)) {
>>>                 fprintf(stdout, "Connection closing..\n");
>>>                 close(*connfd);
>>>                 *connfd = -1;
>>> --
>>> 2.7.4
>> I applied the patch, but I cannot apply it as it is via git-am. I
>> suppose isues with your mailer, git-am reports that cannot be applied -
>> even if it looks apparently correct. So I did on my own. Can you check
>> it for future ?
> 
> I use git send-email. The patch doesn't work because the tabs are replaced by spaces.
> 
> The email I received use tabs but all other emails use spaces. I don't know why.

Right, I see the same.

> 
>>> Also your previous patchset looks strange. I do not see all patches in
>> patchwork, just the first two (that I will apply, anyway).
> 
> I use git send-email and all mails reached the mailing list.

The weird things is with Patchwork. Just the first two patches were
included in Patchwork, the other ones disappeared. Strange.

Best regards,
Stefano Babic
Herbrechtsmeier Dr.-Ing. , Stefan Oct. 26, 2017, 7:28 a.m. UTC | #5
Hi Stefano,

> Von: Stefano Babic [mailto:sbabic@denx.de]
> Gesendet: Freitag, 20. Oktober 2017 10:05
> An: Herbrechtsmeier Dr.-Ing. , Stefan; sbabic@denx.de;
> swupdate@googlegroups.com
> Betreff: Re: AW: [swupdate] [PATCH] progress_ipc: Use correct read size
> inside receive function
>
> On 20/10/2017 09:40, Stefan.Herbrechtsmeier@weidmueller.com wrote:
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: Stefano Babic [mailto:sbabic@denx.de]
> >> Gesendet: Donnerstag, 19. Oktober 2017 16:26
> >> An: Herbrechtsmeier Dr.-Ing. , Stefan; swupdate@googlegroups.com
> >> Betreff: Re: [swupdate] [PATCH] progress_ipc: Use correct read size
> >> inside receive function
> >>
> >> On 19/10/2017 11:24, Stefan Herbrechtsmeier wrote:
> >>> The progress_ipc_receive function wrongly read a message with the
> >>> pointer size and not the struct size.
> >>>
> >>> Signed-off-by: Stefan Herbrechtsmeier
> >>> <stefan.herbrechtsmeier@weidmueller.com>
> >>> ---
> >>>  ipc/progress_ipc.c | 4 ++--
> >>>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/ipc/progress_ipc.c b/ipc/progress_ipc.c index
> >>> 324f94e..ab50b1c 100644
> >>> --- a/ipc/progress_ipc.c
> >>> +++ b/ipc/progress_ipc.c
> >>> @@ -60,8 +60,8 @@ int progress_ipc_connect(bool reconnect)  }
> >>>
> >>>  int progress_ipc_receive(int *connfd, struct progress_msg *msg) {
> >>> -       int ret = read(*connfd, msg, sizeof(msg));
> >>> -       if (ret != sizeof(msg)) {
> >>> +       int ret = read(*connfd, msg, sizeof(*msg));
> >>> +       if (ret != sizeof(*msg)) {
> >>>                 fprintf(stdout, "Connection closing..\n");
> >>>                 close(*connfd);
> >>>                 *connfd = -1;
> >>> --
> >>> 2.7.4
> >> I applied the patch, but I cannot apply it as it is via git-am. I
> >> suppose isues with your mailer, git-am reports that cannot be
> applied
> >> - even if it looks apparently correct. So I did on my own. Can you
> >> check it for future ?
> >
> > I use git send-email. The patch doesn't work because the tabs are
> replaced by spaces.
> >
> > The email I received use tabs but all other emails use spaces. I
> don't know why.
>
> Right, I see the same.

I have resend the patch series via another mail server. I missed to change the subject prefix to RFC.

>
> >
> >>> Also your previous patchset looks strange. I do not see all patches
> >>> in
> >> patchwork, just the first two (that I will apply, anyway).
> >
> > I use git send-email and all mails reached the mailing list.
>
> The weird things is with Patchwork. Just the first two patches were
> included in Patchwork, the other ones disappeared. Strange.

It looks like Patchwork only took the first two patches again.

Best regards

Stefan Herbrechtsmeier
Software Developer Embedded Systems

Let’s connect.
diff mbox series

Patch

diff --git a/ipc/progress_ipc.c b/ipc/progress_ipc.c
index 324f94e..ab50b1c 100644
--- a/ipc/progress_ipc.c
+++ b/ipc/progress_ipc.c
@@ -60,8 +60,8 @@  int progress_ipc_connect(bool reconnect)
 }

 int progress_ipc_receive(int *connfd, struct progress_msg *msg) {
-       int ret = read(*connfd, msg, sizeof(msg));
-       if (ret != sizeof(msg)) {
+       int ret = read(*connfd, msg, sizeof(*msg));
+       if (ret != sizeof(*msg)) {
                fprintf(stdout, "Connection closing..\n");
                close(*connfd);
                *connfd = -1;