Skip to content

Instantly share code, notes, and snippets.

@evdenis
evdenis / context.diff
Created August 9, 2020 20:50
flexible_array.cocci context
Please check for false positives in the output before submitting a patch.
When using "patch" mode, carefully review the patch before submitting it.
diff -u -p ./fs/erofs/erofs_fs.h /tmp/nothing/fs/erofs/erofs_fs.h
--- ./fs/erofs/erofs_fs.h
+++ /tmp/nothing/fs/erofs/erofs_fs.h
@@ -152,7 +152,6 @@ struct erofs_xattr_ibody_header {
__le32 h_reserved;
__u8 h_shared_count;
@evdenis
evdenis / flex.diff
Created August 9, 2020 20:42
flexible_array.cocci patch
diff --git a/arch/alpha/include/asm/hwrpb.h b/arch/alpha/include/asm/hwrpb.h
index d8180e527a1e..fc76f36265ad 100644
--- a/arch/alpha/include/asm/hwrpb.h
+++ b/arch/alpha/include/asm/hwrpb.h
@@ -152,7 +152,7 @@ struct memdesc_struct {
unsigned long chksum;
unsigned long optional_pa;
unsigned long numclusters;
- struct memclust_struct cluster[0];
+ struct memclust_struct cluster[];
@evdenis
evdenis / memweight.c
Last active September 13, 2019 11:25
Memweight
#include <assert.h>
#define BITS_PER_BYTE 8
#define BITS_PER_LONG 64
#define INT_MAX ((int)(~0U >> 1))
#define UINT_MAX (~0U)
#define __const_hweight8(w) ((unsigned int) ((!!((w) & (1ULL << 0))) + (!!((w) & (1ULL << 1))) + (!!((w) & (1ULL << 2))) + (!!((w) & (1ULL << 3))) + (!!((w) & (1ULL << 4))) + (!!((w) & (1ULL << 5))) + (!!((w) & (1ULL << 6))) + (!!((w) & (1ULL << 7)))))
@evdenis
evdenis / check_static_export.pl
Created July 14, 2019 12:51
Check that exported symbols in the Linux kernel are global
#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
# check_static_export.pl - check that exported symbols are global
# (c) 2019 Denis Efremov <efremov@linux.com>
use strict;
use warnings;
foreach (@ARGV) {
my %symb;
@evdenis
evdenis / remove_acsl_specs.pl
Created September 4, 2018 14:09
Script for removing ACSL specifications from C files
#!/usr/bin/env perl
use warnings;
use strict;
use Fcntl qw(:flock SEEK_END);
unless (@ARGV) {
die("usage: $0 <files>\n");
}
@evdenis
evdenis / keybase
Created May 26, 2018 19:13
keybase proof
### Keybase proof
I hereby claim:
* I am evdenis on github.
* I am efremov (https://keybase.io/efremov) on keybase.
* I have a public key ASDoFXA8YfMZwcyRUpQRSF9BR9nP9TySXUdYl0Y3qgwnfwo
To claim this, I am signing this object:
@evdenis
evdenis / META
Created December 18, 2016 12:57 — forked from kerneis/META
CIL plugin example
version = "0.1"
description = "count and display the number of function calls"
archive(byte,plugin) = "countCalls.cma"
archive(native,plugin) = "countCalls.cmxs"
@evdenis
evdenis / ghost.conf
Created July 18, 2016 12:07
Apache configuration for Ghost blogging platform through unix socket
<VirtualHost *:80>
ServerName blog.llkl.org
ServerAdmin admin@llkl.org
ProxyRequests Off
ProxyPreserveHost On
<Location />
ProxyPass unix:/run/ghost/sock|http://127.0.0.1/
ProxyPassReverse unix:/run/ghost/sock|http://127.0.0.1/
@evdenis
evdenis / ghost_upgrade.sh
Created July 18, 2016 12:02
Upgrade script for Ghost blogging platform
#!/bin/bash -x
# Остановить скрипт, если любая команда завершится с ошибкой
set -e
# -- BEGIN CONFIGURATION --
## Директория, где располагаются файлы Ghost
ghost_dir='/var/www/ghost'
## Директория, куда загрузить обновлённую версию
download_dir="$(mktemp -d)"
@evdenis
evdenis / ghost.service
Created July 18, 2016 11:58
Systemd service file for Ghost blogging platform
[Unit]
Description=Ghost blog
After=network.target
[Service]
Type=simple
PIDFile=/run/ghost/pid
WorkingDirectory=/var/www/ghost
RuntimeDirectory=ghost
User=ghost