[sane-devel] (patch) Small fixes for canon630u, coolscan and microtek2

Major A andras@users.sourceforge.net
Sat, 5 Oct 2002 03:16:00 +0100


Petter,

> If sizeof(size_t) is bigger then sizeof(u_int32_t), than the call to
> sanei_scsi_cmd() will write outside the space allocated for
> ms->n_control_bytes.  If it is smaller, the value in
> ms->n_control_bytes will be wrong.  It only work as it should if
> size_t and u_int32_t is the same type.  This is not the case on
> 64-bit machines.

This is definitely a bug in that backend, but your solution doesn't
solve anything. The only thing it might do is create a compiler
warning which is not much use to the end user anyway. (In fact, it
will certainly cause the compiler to warn about an unused variable.)

This needs fixing, I agree, and it should be done before 1.0.9. The
solution should be rather easy, I guess the types involved should
either be all size_t or all u_int32_t, but I can't tell (I haven't got
the time to look at the code right now).

BTW, is there any specified lower limit for sizeof(size_t), i.e. can
we safely assume that size_t can always take 32-bit values? Probably
not a problem in this case, but it could have interesting implications
now that open-source software on embedded devices, PDAs etc. is taking
off.

  Andras

===========================================================================
Major Andras
    e-mail: andras@users.sourceforge.net
    www:    http://andras.webhop.org/
===========================================================================