2010-07-21 13:01:25

by Christian Dietrich

[permalink] [raw]
Subject: CONFIG_SCSI_G_NCR5380_MEM dead?

Hi all!

As part of the VAMOS[0] research project at the University of
Erlangen we are looking at multiple integrity errors in linux'
configuration system.

I've been running a check on the drivers/scsi sourcetree for
config Items not defined in Kconfig and found such a case. Sourcecode
blocks depending on these Items are not reachable from a vanilla
kernel -- dead code. I've seen such dead blocks made on purpose
e.g. while integrating new features into the kernel but generally
they're just useless.

I encountered, that the CONFIG_SCSI_G_NCR5380_MEM symbol in
drivers/scsi/g_NCR5380.c isn't defined anywhere. So this codeblocks
seems to be unreachable. But there is a define in g_NCR5380_mmio.c for
SCSI_G_NCR5380_MEM with an include of g_NCR5380.c. So i think this is a
typo-bug and it should be a CONFIG_ define. The code wasn't changed since
linux is in git, so probably no one has used the mmio module, cause
there can't be a difference to the normal pio module. If you think this
ifdefs should be removed, i can send a patch.

Regards

Christian Dietrich
--
(λ x . x x) (λ x . x x) -- See how beatiful the lambda is
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.


2010-07-21 13:12:11

by Ondrej Zary

[permalink] [raw]
Subject: Re: CONFIG_SCSI_G_NCR5380_MEM dead?

On Wednesday 21 July 2010, Christian Dietrich wrote:
> Hi all!
>
> As part of the VAMOS[0] research project at the University of
> Erlangen we are looking at multiple integrity errors in linux'
> configuration system.
>
> I've been running a check on the drivers/scsi sourcetree for
> config Items not defined in Kconfig and found such a case. Sourcecode
> blocks depending on these Items are not reachable from a vanilla
> kernel -- dead code. I've seen such dead blocks made on purpose
> e.g. while integrating new features into the kernel but generally
> they're just useless.
>
> I encountered, that the CONFIG_SCSI_G_NCR5380_MEM symbol in
> drivers/scsi/g_NCR5380.c isn't defined anywhere. So this codeblocks
> seems to be unreachable. But there is a define in g_NCR5380_mmio.c for
> SCSI_G_NCR5380_MEM with an include of g_NCR5380.c. So i think this is a
> typo-bug and it should be a CONFIG_ define. The code wasn't changed since
> linux is in git, so probably no one has used the mmio module, cause
> there can't be a difference to the normal pio module. If you think this
> ifdefs should be removed, i can send a patch.

I fixed this some time ago but the patches are still not in mainline. You can
find them in -mm tree: http://userweb.kernel.org/~akpm/mmotm/

--
Ondrej Zary

2010-07-21 15:19:52

by James Bottomley

[permalink] [raw]
Subject: Re: CONFIG_SCSI_G_NCR5380_MEM dead?

On Wed, 2010-07-21 at 15:01 +0200, Christian Dietrich wrote:
> Hi all!
>
> As part of the VAMOS[0] research project at the University of
> Erlangen we are looking at multiple integrity errors in linux'
> configuration system.
>
> I've been running a check on the drivers/scsi sourcetree for
> config Items not defined in Kconfig and found such a case. Sourcecode
> blocks depending on these Items are not reachable from a vanilla
> kernel -- dead code. I've seen such dead blocks made on purpose
> e.g. while integrating new features into the kernel but generally
> they're just useless.
>
> I encountered, that the CONFIG_SCSI_G_NCR5380_MEM symbol in
> drivers/scsi/g_NCR5380.c isn't defined anywhere. So this codeblocks
> seems to be unreachable. But there is a define in g_NCR5380_mmio.c for
> SCSI_G_NCR5380_MEM with an include of g_NCR5380.c. So i think this is a
> typo-bug and it should be a CONFIG_ define. The code wasn't changed since
> linux is in git, so probably no one has used the mmio module, cause
> there can't be a difference to the normal pio module. If you think this
> ifdefs should be removed, i can send a patch.

Actually, I'd rather not remove any code like this. We have no
documentation for the board, so that code represents the only knowledge
we have about how to program it. Although, in theory, git will remember,
in practice no-one will know where to look for it if they want to try
resurrecting the MMIO code.

James

2010-07-21 15:23:32

by James Bottomley

[permalink] [raw]
Subject: Re: CONFIG_SCSI_G_NCR5380_MEM dead?

On Wed, 2010-07-21 at 15:12 +0200, Ondrej Zary wrote:
> On Wednesday 21 July 2010, Christian Dietrich wrote:
> > Hi all!
> >
> > As part of the VAMOS[0] research project at the University of
> > Erlangen we are looking at multiple integrity errors in linux'
> > configuration system.
> >
> > I've been running a check on the drivers/scsi sourcetree for
> > config Items not defined in Kconfig and found such a case. Sourcecode
> > blocks depending on these Items are not reachable from a vanilla
> > kernel -- dead code. I've seen such dead blocks made on purpose
> > e.g. while integrating new features into the kernel but generally
> > they're just useless.
> >
> > I encountered, that the CONFIG_SCSI_G_NCR5380_MEM symbol in
> > drivers/scsi/g_NCR5380.c isn't defined anywhere. So this codeblocks
> > seems to be unreachable. But there is a define in g_NCR5380_mmio.c for
> > SCSI_G_NCR5380_MEM with an include of g_NCR5380.c. So i think this is a
> > typo-bug and it should be a CONFIG_ define. The code wasn't changed since
> > linux is in git, so probably no one has used the mmio module, cause
> > there can't be a difference to the normal pio module. If you think this
> > ifdefs should be removed, i can send a patch.
>
> I fixed this some time ago but the patches are still not in mainline. You can
> find them in -mm tree: http://userweb.kernel.org/~akpm/mmotm/

So you made me rather reluctant by reporting that the rewrite didn't
actually work for you. I'm rather wary of transforming non-compiled
code into non-working code in case we lose some clue in the process.
However, if you can get it working, I'll be delighted to apply it.

James