On Fri, Feb 04, 2005 at 09:41:42PM -0800, David S. Miller wrote:
> On Fri, 04 Feb 2005 22:04:38 -0600
> Bob Breuer <[EMAIL PROTECTED]> wrote:
> > Anyway, for this bug with the cg14, the return value of
> > prom_getproperty() was not checked.  A quick check of 2.6.10 shows
> > that the return value of prom_getproperty() is not used in 25 out
> > of 111 cases for sparc32.  Would it make sense to mark this
> > function with __must_check?  I suppose the cleanups would be too
> > much effort for too little gain.
> 
> That would be a great idea.  In particular, things like
> tree.c:prom_nodematch() should check (and return "0" when
> error occurs).

How does this look? It compiled but is untested in a running kernel.

Art Haas

===== arch/sparc/prom/tree.c 1.1 vs edited =====
--- 1.1/arch/sparc/prom/tree.c  2002-02-05 11:40:23 -06:00
+++ edited/arch/sparc/prom/tree.c       2005-02-06 16:18:29 -06:00
@@ -176,8 +176,11 @@
  */
 int prom_nodematch(int node, char *name)
 {
+       int error;
+
        static char namebuf[128];
-       prom_getproperty(node, "name", namebuf, sizeof(namebuf));
+       error = prom_getproperty(node, "name", namebuf, sizeof(namebuf));
+       if (error == -1) return 0;
        if(strcmp(namebuf, name) == 0) return 1;
        return 0;
 }

-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
-
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to