Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/gpio Never fib about pin count in GPIOINFO ioctl res...



details:   https://anonhg.NetBSD.org/src/rev/97224d4592a1
branches:  trunk
changeset: 372632:97224d4592a1
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Tue Dec 13 21:50:43 2022 +0000

description:
Never fib about pin count in GPIOINFO ioctl results.  The number of pins
on a controller simply does not change depending on the privileges of
the caller.

diffstat:

 sys/dev/gpio/gpio.c |  16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diffs (44 lines):

diff -r a4587e601be0 -r 97224d4592a1 sys/dev/gpio/gpio.c
--- a/sys/dev/gpio/gpio.c       Tue Dec 13 21:47:36 2022 +0000
+++ b/sys/dev/gpio/gpio.c       Tue Dec 13 21:50:43 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.71 2022/04/27 23:15:30 brad Exp $ */
+/* $NetBSD: gpio.c,v 1.72 2022/12/13 21:50:43 jakllsch Exp $ */
 /*     $OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.71 2022/04/27 23:15:30 brad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.72 2022/12/13 21:50:43 jakllsch Exp $");
 
 /*
  * General Purpose Input/Output framework.
@@ -728,7 +728,7 @@
        device_t dv;
        cfdata_t cf;
        int locs[GPIOCF_NLOCS];
-       int error, pin, value, flags, npins;
+       int error, pin, value, flags;
 
        gc = sc->sc_gc;
        ga.ga_flags = 0;
@@ -742,15 +742,7 @@
        switch (cmd) {
        case GPIOINFO:
                info = data;
-               if (!kauth_authorize_device(l->l_cred,
-                   KAUTH_DEVICE_GPIO_PINSET, NULL, NULL, NULL, NULL))
-                       info->gpio_npins = sc->sc_npins;
-               else {
-                       for (pin = npins = 0; pin < sc->sc_npins; pin++)
-                               if (sc->sc_pins[pin].pin_flags & GPIO_PIN_SET)
-                                       ++npins;
-                       info->gpio_npins = npins;
-               }
+               info->gpio_npins = sc->sc_npins;
                break;
        case GPIOREAD:
                req = data;



Home | Main Index | Thread Index | Old Index