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:   Mon, 15 Apr 2019 20:07:10 +1000
From:   "Alastair D'Silva" <alastair@...ilva.org>
To:     "'Petr Mladek'" <pmladek@...e.com>
Cc:     "'Alastair D'Silva'" <alastair@....ibm.com>,
        "'Jani Nikula'" <jani.nikula@...ux.intel.com>,
        "'Joonas Lahtinen'" <joonas.lahtinen@...ux.intel.com>,
        "'Rodrigo Vivi'" <rodrigo.vivi@...el.com>,
        "'David Airlie'" <airlied@...ux.ie>,
        "'Daniel Vetter'" <daniel@...ll.ch>,
        "'Karsten Keil'" <isdn@...ux-pingi.de>,
        "'Jassi Brar'" <jassisinghbrar@...il.com>,
        "'Tom Lendacky'" <thomas.lendacky@....com>,
        "'David S. Miller'" <davem@...emloft.net>,
        "'Jose Abreu'" <Jose.Abreu@...opsys.com>,
        "'Kalle Valo'" <kvalo@...eaurora.org>,
        "'Stanislaw Gruszka'" <sgruszka@...hat.com>,
        "'Benson Leung'" <bleung@...omium.org>,
        "'Enric Balletbo i Serra'" <enric.balletbo@...labora.com>,
        "'James E.J. Bottomley'" <jejb@...ux.ibm.com>,
        "'Martin K. Petersen'" <martin.petersen@...cle.com>,
        "'Greg Kroah-Hartman'" <gregkh@...uxfoundation.org>,
        "'Alexander Viro'" <viro@...iv.linux.org.uk>,
        "'Sergey Senozhatsky'" <sergey.senozhatsky@...il.com>,
        "'Steven Rostedt'" <rostedt@...dmis.org>,
        "'Andrew Morton'" <akpm@...ux-foundation.org>,
        <intel-gfx@...ts.freedesktop.org>,
        <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
        <netdev@...r.kernel.org>, <ath10k@...ts.infradead.org>,
        <linux-wireless@...r.kernel.org>, <linux-scsi@...r.kernel.org>,
        <linux-fbdev@...r.kernel.org>, <devel@...verdev.osuosl.org>,
        <linux-fsdevel@...r.kernel.org>
Subject: RE: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags

> -----Original Message-----
> From: Petr Mladek <pmladek@...e.com>
> Sent: Monday, 15 April 2019 7:24 PM
> To: Alastair D'Silva <alastair@...ilva.org>
> Cc: 'Alastair D'Silva' <alastair@....ibm.com>; 'Jani Nikula'
> <jani.nikula@...ux.intel.com>; 'Joonas Lahtinen'
> <joonas.lahtinen@...ux.intel.com>; 'Rodrigo Vivi'
<rodrigo.vivi@...el.com>;
> 'David Airlie' <airlied@...ux.ie>; 'Daniel Vetter' <daniel@...ll.ch>;
'Karsten
> Keil' <isdn@...ux-pingi.de>; 'Jassi Brar' <jassisinghbrar@...il.com>; 'Tom
> Lendacky' <thomas.lendacky@....com>; 'David S. Miller'
> <davem@...emloft.net>; 'Jose Abreu' <Jose.Abreu@...opsys.com>; 'Kalle
> Valo' <kvalo@...eaurora.org>; 'Stanislaw Gruszka' <sgruszka@...hat.com>;
> 'Benson Leung' <bleung@...omium.org>; 'Enric Balletbo i Serra'
> <enric.balletbo@...labora.com>; 'James E.J. Bottomley'
> <jejb@...ux.ibm.com>; 'Martin K. Petersen' <martin.petersen@...cle.com>;
> 'Greg Kroah-Hartman' <gregkh@...uxfoundation.org>; 'Alexander Viro'
> <viro@...iv.linux.org.uk>; 'Sergey Senozhatsky'
> <sergey.senozhatsky@...il.com>; 'Steven Rostedt'
> <rostedt@...dmis.org>; 'Andrew Morton' <akpm@...ux-foundation.org>;
> intel-gfx@...ts.freedesktop.org; dri-devel@...ts.freedesktop.org; linux-
> kernel@...r.kernel.org; netdev@...r.kernel.org;
> ath10k@...ts.infradead.org; linux-wireless@...r.kernel.org; linux-
> scsi@...r.kernel.org; linux-fbdev@...r.kernel.org;
> devel@...verdev.osuosl.org; linux-fsdevel@...r.kernel.org
> Subject: Re: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in
> hex_dump_to_buffer with flags
> 
> On Sat 2019-04-13 09:31:27, Alastair D'Silva wrote:
> > > -----Original Message-----
> > > From: Petr Mladek <pmladek@...e.com>
> > > Sent: Saturday, 13 April 2019 12:12 AM
> > > To: Alastair D'Silva <alastair@....ibm.com>
> > > Cc: alastair@...ilva.org; Jani Nikula <jani.nikula@...ux.intel.com>;
> > Joonas
> > > Lahtinen <joonas.lahtinen@...ux.intel.com>; Rodrigo Vivi
> > > <rodrigo.vivi@...el.com>; David Airlie <airlied@...ux.ie>; Daniel
> > > Vetter <daniel@...ll.ch>; Karsten Keil <isdn@...ux-pingi.de>; Jassi
> > > Brar <jassisinghbrar@...il.com>; Tom Lendacky
> > > <thomas.lendacky@....com>; David S. Miller
> <davem@...emloft.net>;
> > > Jose Abreu <Jose.Abreu@...opsys.com>; Kalle Valo
> > > <kvalo@...eaurora.org>; Stanislaw Gruszka <sgruszka@...hat.com>;
> > > Benson Leung <bleung@...omium.org>; Enric Balletbo i Serra
> > > <enric.balletbo@...labora.com>; James E.J. Bottomley
> > > <jejb@...ux.ibm.com>; Martin K. Petersen
> > > <martin.petersen@...cle.com>; Greg Kroah-Hartman
> > > <gregkh@...uxfoundation.org>; Alexander Viro
> > > <viro@...iv.linux.org.uk>; Sergey Senozhatsky
> > > <sergey.senozhatsky@...il.com>; Steven Rostedt
> > > <rostedt@...dmis.org>; Andrew Morton <akpm@...ux-
> foundation.org>;
> > > intel- gfx@...ts.freedesktop.org; dri-devel@...ts.freedesktop.org;
> > > linux- kernel@...r.kernel.org; netdev@...r.kernel.org;
> > > ath10k@...ts.infradead.org; linux-wireless@...r.kernel.org; linux-
> > > scsi@...r.kernel.org; linux-fbdev@...r.kernel.org;
> > > devel@...verdev.osuosl.org; linux-fsdevel@...r.kernel.org
> > > Subject: Re: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in
> > > hex_dump_to_buffer with flags
> > >
> > > On Wed 2019-04-10 13:17:19, Alastair D'Silva wrote:
> > > > From: Alastair D'Silva <alastair@...ilva.org>
> > > >
> > > > In order to support additional features in hex_dump_to_buffer,
> > > > replace the ascii bool parameter with flags.
> > > >
> > > > Signed-off-by: Alastair D'Silva <alastair@...ilva.org>
> > > > ---
> > > >  drivers/gpu/drm/i915/intel_engine_cs.c            |  2 +-
> > > >  drivers/isdn/hardware/mISDN/mISDNisar.c           |  6 ++++--
> > > >  drivers/mailbox/mailbox-test.c                    |  2 +-
> > > >  drivers/net/ethernet/amd/xgbe/xgbe-drv.c          |  2 +-
> > > >  drivers/net/ethernet/synopsys/dwc-xlgmac-common.c |  2 +-
> > > >  drivers/net/wireless/ath/ath10k/debug.c           |  3 ++-
> > > >  drivers/net/wireless/intel/iwlegacy/3945-mac.c    |  2 +-
> > > >  drivers/platform/chrome/wilco_ec/debugfs.c        |  3 ++-
> > > >  drivers/scsi/scsi_logging.c                       |  8 +++-----
> > > >  drivers/staging/fbtft/fbtft-core.c                |  2 +-
> > > >  fs/seq_file.c                                     |  3 ++-
> > > >  include/linux/printk.h                            |  2 +-
> > > >  lib/hexdump.c                                     | 15
++++++++-------
> > > >  lib/test_hexdump.c                                |  5 +++--
> > > >  14 files changed, 31 insertions(+), 26 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c
> > > > b/drivers/gpu/drm/i915/intel_engine_cs.c
> > > > index 49fa43ff02ba..fb133e729f9a 100644
> > > > --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> > > > +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> > > > @@ -1318,7 +1318,7 @@ static void hexdump(struct drm_printer *m,
> > > > const
> > > void *buf, size_t len)
> > > >  		WARN_ON_ONCE(hex_dump_to_buffer(buf + pos, len -
> > > pos,
> > > >  						rowsize,
sizeof(u32),
> > > >  						line, sizeof(line),
> > > > -						false) >=
sizeof(line));
> > > > +						0) >= sizeof(line));
> > >
> > > It might be more clear when we define:
> > >
> > > #define HEXDUMP_BINARY 0
> >
> > This feels unnecessary, and weird. Omitting the flag won't disable the
> > hex output (as expected), and if you don't want hex output why call
> > hexdump in the first place?
> 
> Why do we have HEXDUMP_ASCII then?
> Why is the above funtion not using HEXDUMP_ASCII?
> Who would call it with (HEXDUMP_ASCII | HEXDUMP_BINARY)?

The ASCII flag controls the optional ASCII output, and replaces the boolean
that existed prior. A user would enable it in the same situations where they
currently pass true for the ascii parameter.

In the above example the author only wants the hex output, while in other
situations, both hex & ASCII output is desirable. If you just want ASCII
output, the caller should just use a printk or one of it's wrappers.

-- 
Alastair D'Silva           mob: 0423 762 819
skype: alastair_dsilva     msn: alastair@...ilva.org
blog: http://alastair.d-silva.org    Twitter: @EvilDeece

Powered by blists - more mailing lists