Bug 7189 - Inconsistent /proc/fb behavior
Summary: Inconsistent /proc/fb behavior
Alias: None
Product: Drivers
Classification: Unclassified
Component: Console/Framebuffers (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Antonino Daplas
Depends on:
Reported: 2006-09-22 19:17 UTC by Jurij Smakov
Modified: 2006-09-27 00:41 UTC (History)
0 users

See Also:
Kernel Version:
Tree: Mainline
Regression: ---


Description Jurij Smakov 2006-09-22 19:17:06 UTC
Distribution: Debian unstable
Hardware environment: Sparc Ultra60 workstation

Problem Description:
It appears that the function fbmem_read_proc, which serves as a backend for the
/proc/fb file, has a problem. When constructing the list of available frame
buffers to return to the user, it uses the following for-cycle;

for (fi = registered_fb; fi < &registered_fb[FB_MAX] && len < 4000; fi++)

Here len is the parameter passed to the function, that it the amount of data the
user is requesting from the file. So if the user requests a chunk larger than
4000 bytes, nothing is returned, leading to the peculiar behaviour described below.

Steps to reproduce:

$ cat /proc/fb
0 Creator 3D

This works fine, because strace shows that cat is reading data in 1024-byte chunks:
read(3, "0 Creator 3D\n", 1024)         = 13

OTOH, grep is reading data in 32kB chunks:
read(3, "", 32768)                      = 0

so the command 'grep Creator /proc/fb' returns nothing (quite unexpectingly). I
suspect that for-loop should have 'clen' rather than 'len', the local variable
which tracks the size of the buffer (even though I am not sure why one would
want to impose a 4000 byte limit here).

Note You need to log in before you can comment on or make changes to this bug.