lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Jul 2022 15:38:18 +0000
From:   Frank Jungclaus <Frank.Jungclaus@....eu>
To:     "mailhol.vincent@...adoo.fr" <mailhol.vincent@...adoo.fr>
CC:     Stefan Mätje <Stefan.Maetje@....eu>,
        "linux-can@...r.kernel.org" <linux-can@...r.kernel.org>,
        "mkl@...gutronix.de" <mkl@...gutronix.de>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "wg@...ndegger.com" <wg@...ndegger.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/6] can: esd_usb: Improved decoding for
 ESD_EV_CAN_ERROR_EXT messages

On Tue, 2022-07-12 at 10:33 +0900, Vincent MAILHOL wrote:
> On Sat. 9 Jul. 2022 at 03:14, Frank Jungclaus <frank.jungclaus@....eu> wrote:
> > As suggested by Vincent I spend a union plus a struct ev_can_err_ext
> 
> The canonical way to declare that something was suggested by someone
> else is to use the Suggested-by tag.
> 
> Also, this particular change was suggested by Marc, not by me ;)
> https://lore.kernel.org/linux-can/20220621071152.ggyhrr5sbzvwpkpx@pengutronix.de/

Ops, sorry for mixing up your names. So the kudos goes to Marc ;)
I'll spend a Suggested-by tag and resend patch 6/6.

Best regards,
Frank

> 
> > for easier decoding of an ESD_EV_CAN_ERROR_EXT event message (which
> > simply is a rx_msg with some dedicated data).
> 
> Suggested-by: Marc Kleine-Budde <mkl@...gutronix.de>
> 
> > Signed-off-by: Frank Jungclaus <frank.jungclaus@....eu>
> > ---
> >  drivers/net/can/usb/esd_usb.c | 20 ++++++++++++++------
> >  1 file changed, 14 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/net/can/usb/esd_usb.c b/drivers/net/can/usb/esd_usb.c
> > index 09649a45d6ff..2b149590720c 100644
> > --- a/drivers/net/can/usb/esd_usb.c
> > +++ b/drivers/net/can/usb/esd_usb.c
> > @@ -126,7 +126,15 @@ struct rx_msg {
> >         u8 dlc;
> >         __le32 ts;
> >         __le32 id; /* upper 3 bits contain flags */
> > -       u8 data[8];
> > +       union {
> > +               u8 data[8];
> > +               struct {
> > +                       u8 status; /* CAN Controller Status */
> > +                       u8 ecc;    /* Error Capture Register */
> > +                       u8 rec;    /* RX Error Counter */
> > +                       u8 tec;    /* TX Error Counter */
> > +               } ev_can_err_ext;  /* For ESD_EV_CAN_ERROR_EXT */
> > +       };
> >  };
> > 
> >  struct tx_msg {
> > @@ -134,7 +142,7 @@ struct tx_msg {
> >         u8 cmd;
> >         u8 net;
> >         u8 dlc;
> > -       u32 hnd;        /* opaque handle, not used by device */
> > +       u32 hnd;   /* opaque handle, not used by device */
> >         __le32 id; /* upper 3 bits contain flags */
> >         u8 data[8];
> >  };
> > @@ -228,11 +236,11 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
> >         u32 id = le32_to_cpu(msg->msg.rx.id) & ESD_IDMASK;
> > 
> >         if (id == ESD_EV_CAN_ERROR_EXT) {
> > -               u8 state = msg->msg.rx.data[0];
> > -               u8 ecc   = msg->msg.rx.data[1];
> > +               u8 state = msg->msg.rx.ev_can_err_ext.status;
> > +               u8 ecc   = msg->msg.rx.ev_can_err_ext.ecc;
> > 
> > -               priv->bec.rxerr = msg->msg.rx.data[2];
> > -               priv->bec.txerr = msg->msg.rx.data[3];
> > +               priv->bec.rxerr = msg->msg.rx.ev_can_err_ext.rec;
> > +               priv->bec.txerr = msg->msg.rx.ev_can_err_ext.tec;
> > 
> >                 netdev_dbg(priv->netdev,
> >                            "CAN_ERR_EV_EXT: dlc=%#02x state=%02x ecc=%02x rec=%02x tec=%02x\n",
> 
> Yours sincerely,
> Vincent Mailhol

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ