lkml.org 
[lkml]   [2008]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH 01/01][retry 3] x86: L3 cache index disable for 2.6.26
Date
From
> > +
> > + ret = sscanf(buf, "%x", &val);
> > + if (ret != 1)
> > + return -EINVAL;
>
> Is it okay to strlen() on user-supplied data? Do they have to be
> null-terminated? What about sscanf?

The strlen can go - it's no longer necessary.

If sscanf isn't safe in this context, there's a lot of code
in drivers/cpufreq/cpufreq.c that I cribbed from that needs
to be changed, too.

> > + val |= 0xc0000000;
> > + pci_write_config_dword(dev, 0x1BC + index * 4, val
> & ~0x40000000);
> > + wbinvd();
> > + pci_write_config_dword(dev, 0x1BC + index * 4, val);
>
> Should it do if capable() test before doing such stuff?

I don't think so. If it got this far, it is an AMD processor
from family 0x10 or later, so it has wbinvd().

-Mark Langsdorf
Operating System Research Center
AMD



\
 
 \ /
  Last update: 2008-08-14 16:05    [W:0.065 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site