Browse Source

fixed cppcheck warnings

master
Mathieu Serandour 11 months ago
parent
commit
d7d998d490
  1. 9
      kernel/drivers/nvme/nvme.c
  2. 2
      kernel/int/irq.c
  3. 10
      kernel/lib/dump.c

9
kernel/drivers/nvme/nvme.c

@ -97,17 +97,18 @@ void perform_write_command(
static void rename_device(struct pcie_dev* dev) {
static unsigned id = 0;
string_free(&dev->dev.name);
char* buff = malloc(16);
static unsigned id = 0;
dev->dev.name = (string_t){malloc(16), 1};
sprintf(buff,
sprintf(dev->dev.name.ptr,
"nvme%un1", id++);
// only namespace 1 is supported
// for now
dev->dev.name = (string_t){buff, 1};
}

2
kernel/int/irq.c

@ -74,7 +74,7 @@ void irq_common_handler(uint8_t irq_n) {
if(!handler) {
char buff[64];
sprintf(buff, "IRQ%u fired, but no handler is specified");
sprintf(buff, "IRQ%u fired, but no handler is specified", irq_n);
panic (buff);
}

10
kernel/lib/dump.c

@ -78,9 +78,13 @@ void dump(const void* addr, size_t size, size_t line_size, uint8_t mode) {
// iterator ptr
const uint8_t* ptr = addr;
// create mask : create the complementary with 0xff...ff << n
// then complement it
const uint64_t mask = ~(~0llu << 8*pitch);
// create mask : create the complementary with 0xff...ff << n
// then complement it
// apparently, shifting by 64 a 64 bit value produces
// undefined behavior. Then, we split the operation
uint64_t mask = ~0llu << 4*pitch;
mask = ~(mask << 4*pitch);
for(size_t i = 0; i < lines; i++) {
// the last line might not be full

Loading…
Cancel
Save