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, 23 Jan 2012 08:13:59 -0800
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Yinghai Lu <yinghai@...nel.org>
Cc:	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>,
	Matthew Wilcox <matthew@....cx>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org, Yinghai Lu <yinghai.lu@...cle.com>
Subject: Re: [PATCH 6/7] pciehp: Add Disable/enable link functions

On Sat, Jan 21, 2012 at 1:52 AM, Yinghai Lu <yinghai@...nel.org> wrote:
> +
> +       retval = pciehp_readw(ctrl, PCI_EXP_LNKCTL, &lnk_ctrl);
> +       if (retval) {
> +               ctrl_err(ctrl, "Cannot read LNKCTRL register\n");
> +               return retval;
> +       }

Is there really any point at all in checking the return value of that
readw() function?

Nobody actually ever sets it. We should stop even bothering to pretend
to care. There is no return value in real life.

If the device doesn't exist or the read fails, you will never ever get
an error *anyway*. You'll likely get 0xffff, and possibly a machine
check exception. And that is unlikely to ever change - even if the
hardware were to do it, it's insane to do error checking on an
individual IO level. It causes more problems than it could possibly
ever solve - error checking has to be done at a different level than
on some random individual access.

We should make the return type of pci_read_config_word() be 'void',
instead of having code like this that looks like it is careful, but in
actual fact in reality is just totally pointless.

                          Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ