• Alexander Viro's avatar
    [PATCH] ppc64: Fix rtas file mess · ca4a6985
    Alexander Viro authored
    This does the seq_file conversion + annotation + cleanup + race fixes
    for arch/ppc64/kernel/rtas-proc.c.
    
    How the fuck did that file manage to get anywhere near the tree, anyway?
    Take a look at guy's "implementation" of sprintf(buf, "%04d", num), for
    example:
    
    <vomit>
    	/* construct the sensor number like 0003 */
    	/* fill with zeros */
    	n = sprintf(tmp, "%d", s.token);
    	len = strlen(tmp);
    	while (strlen(tmp) < 4)
    		n += sprintf (tmp+n, "0");
    
    	/* invert the string */
    	while (tmp[i]) {
    		if (i<len)
    			tmp2[4-len+i] = tmp[i];
    		else
    			tmp2[3-i] = tmp[i];
    		i++;
    	}
    	tmp2[4] = '\0';
    </vomit>
    
    And it's full of that level of lusing ;-/
    ca4a6985
rtas-proc.c 22.5 KB